users@glassfish.java.net

Re: Bug in HttpServletRequest.getHeaders() ?

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Mon, 21 Nov 2011 13:25:57 -0800

The javadoc for Servlet 3.0 specification (used in GlassFish 3.x) is in
http://download.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html

I have verified that the following jsp working in 3.1.2 workspace:
<% java.util.Enumeration<String> e = request.getHeaders("accept-language");
     while (e.hasMoreElements()) {
         out.println("accept-language: " + e.nextElement());
     }
%>

Shing Wai Chan


On 11/2/11 2:24 PM, forums_at_java.net wrote:
> I'm using Glassfish 3.1. When invoke HttpServletRequest.getHeaders(),
> which
> suppose to return an enumeration of multiple entries of the same header,
> "Returns all the values of the specified request header as an
> Enumeration of
> String objects." as the specification describes here
> http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletRequest.html
>
> .
>
> However, when invoking the method, it returns only the value of the first
> entry. For example, if a request like:
>
> get localhost:8080
>
> accept-langauge: L1
>
> accept-langauge: L2
>
> The server side code getHeaders("accept-langauge") can only get "L1"
>
> Is it a bug of implemeting the specification?
>
>
>
>
>
>
> --
>
> [Message sent by forum member 'paulur']
>
> View Post: http://forums.java.net/node/859968
>
>