>>> David Gowe <[EMAIL PROTECTED]> 09-Nov-00 6:34:15 PM >>>

>Understood its a request header. So how does this get
>set in the first place?   I understand that we can
>only set response headers.

Ummm... This sounds suspiciously like "I don't know what I'm talking
about - please tell me the answer to all my problems". Perhaps you
should read some of the FAQs that are recommended in the "external
resources" section listed at the bottom of every single email on this
list.

Or alternately the archive of this list. It is list policy to do
these things before just asking here... otherwise this list gets
really noise and you don't get your problems answered (because all the
experts switch off).


However, in the spirit of mealey mouthed co-operation here's the
answer to your questions:

1. the request headers are set by the container when it recieves a
request from a client
Your browser sends an HTTP request which might look something like
this:

  GET /somepath/somefile.html HTTP/1.1
  UA: Imaginary-client
  Content-Length: 0
  Accept: image/*, text/*, audio/*

2. the container your servlet runs in recieves the request and turns
each header line (that's every line in the request but the first one)
into header values which you can get at with:

   request.getHeader(String);

eg:

   request.getHeader("UA");

in this example would return the String: "Imaginary-client"


3. >Secondly, do you have a list of the request and
    >response headers.

You can get a list of all the request headers from the request by
doing this:

   request.getHeaderNames();

that returns an Enumeration of all the different names in the header
table (but see Milt's email on this subject).

In general the complete list of POSSIBLE header names is in the HTTP
spec, which I suggest is something else you might like to read to help
you get up to speed.



Nic

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to