servlet getHeaders

Hi,

I was reading as below

getHeaders
'
Each header name appears only once in the
request. Occasionally, however, a header can appear multiple
times, with each occurrence listing a separate value.

Accept-Language is one such example. If a header name is
repeated in the request, version 2.1 servlets cannot access the
later values without reading the raw input stream, as
getHeader returns the value of the first occurrence of the
header only. In version 2.2, however, getHeaders returns an
Enumeration of the values of all occurrences of the header.
Finally, in addition to looking up the request headers, you can get information
on the main request line itself, also by means of methods in Http-
ServletRequest.'




Accept-Encoding

This header designates the types of encodings that the client knows how to handle. If it receives this header, the server is free to encode the page by using the format specified (usually to reduce transmission time), sending the Content-Encoding response header to indicate that it has
done so. This encoding type is completely distinct from the MIME type of the actual document (as specified in the Content-Type response header), since this encoding is reversed before the browser decides what to do with the content. On the other hand, using an encoding the browser doesn’t understand results in totally incomprehensible pages. Consequently, it is critical that you explicitly check the Accept-Encoding header before using any type of content encoding. Values of gzip or compress are the two standard possibilities.



Cookie

This header is used to return cookies to servers that previously sent them to the browser.This rarely used header lets the client tell the server what kinds of behaviors it expects. The one standard value for this header, 100-continue, is sent by a browser that will be sending an attached document and wants to know if the server will accept it. The server should send a status code of either 100 (Continue) or 417 (Expectation Failed) in such a case.



When i ran sameple program with below code

out.print("<br><br>User agent Header value is :- "
        + request.getHeader("user-agent"));



It outputted mozilla eventhough the servlet ran in eclipse window it self. I wonder why it showed mozilla. Please advise

I have not understood clearly what they means.

Please advise.

Any links resources ideas highly appreciated. Thanks in advance
userAgent.jpg
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
request.getHeader("user-agent")
Gets the header called "user-agent" that was sent by the browser to your servlet that is running inside eclipse. It makes no difference where the servlet runs, this is a property of whatever client is sending the request. Which I am guessing is your Firefox web browser?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
girionisCommented:
It's using the default system web browser, which is the mozilla engine. If you want to change it you can do it from the General->Web Browser option.
0
gudii9Author Commented:
>>>In version 2.2, however, getHeaders returns an
Enumeration of the values of all occurrences of the header.
Finally, in addition to looking up the request headers, you can get information
on the main request line itself, also by means of methods in Http-
ServletRequest.'



how version 2.2 is different from previous version of servlet. ??




>>The one standard value for this header, 100-continue, is sent by a browser that will be sending an attached document and wants to know if the server will accept it. The server should send a status code of either 100 (Continue) or 417 (Expectation Failed) in such a case.

what is 100 and 417. I have not understood this. Is cookie is part of header too??

Please advise
0
girionisCommented:
It's using the default system web browser, which is the mozilla engine. If you want to change it you can do it from the General->Web Browser option.

Guys sorry for this comment, I am not sure how it got here. I probably wanted to answer another question and posted here accidentally!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.