You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kjartan Mikkelsen <Kj...@fast.no> on 2000/03/13 10:09:08 UTC

Http headers

I have a question regarding how reading http headers from the HttpRequest is
supposed to work.

I have this code at the start of doGet

<code>
  Enumeration accept = req.getHeaders("Accept");
  while(accept.hasMoreElements()) {
    String value=(String)accept.nextElement();
    System.out.println("Value:"+value);
    ....
  }
</code>

I get strange output when accessing the servlet from IE5.

<output>
Value:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, applpowerpoint, */*
</output>

Shouldn't this have been:
Value:image/gif
Value:image/gif
Value:image/x-xbitmap

???

When using other clients it seems to work fine ...

I use the beta version downloaded from:
http://jakarta.apache.org/builds/tomcat/release/v3.1_beta_1/src/

Is this a bug ? Is there something I'm doing wrong ?

Mvh

Kjartan


Re: Http headers

Posted by co...@eng.sun.com.
> I have this code at the start of doGet
> 
> <code>
>   Enumeration accept = req.getHeaders("Accept");
>   while(accept.hasMoreElements()) {
>     String value=(String)accept.nextElement();
>     System.out.println("Value:"+value);
>     ....
>   }
> </code>
> 
> I get strange output when accessing the servlet from IE5.
> 
> <output>
> Value:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> application/vnd.ms-excel, applpowerpoint, */*
> </output>
> 
> Shouldn't this have been:
> Value:image/gif
> Value:image/gif
> Value:image/x-xbitmap
> 
> 
> Is this a bug ? Is there something I'm doing wrong ?

None. 
The browser can send either "Accept: type, type, type " or 
"Accept: type1
 Accpet: type2
"

Tomcat will not convert from one format to another, will just report
whatever the browser sent.

Costin