Thanks, Richard!  Can you share a Tomcat version number?  This sounds like
the same issue we've been seeing in GWT hosted mode, and I've been trying to
figure out where this is triggered in the Tomcat codebase so maybe we can
work around it better.  GWT's embedded version is special enough and old
enough that I'm never quite sure if I'm looking at Google's code or Apache
Group's.

On Mon, Nov 17, 2008 at 4:49 AM, Richard Hoberman <
[EMAIL PROTECTED]> wrote:

> Hi
>
> If I make a request using an empty string:
>
> Request request = new Request(Method.POST, "http://localhost:8080/...";);
> request.getClientInfo().getAcceptedMediaTypes().add(new
> Preference<MediaType>(MediaType.APPLICATION_JSON));
> request.setEntity("", MediaType.APPLICATION_JSON);
>
> my accept method will receive an entity with a null mediaType:
>
> public void acceptRepresentation(Representation entity)    throws
> ResourceException {
>
>        MediaType mediaType = entity.getMediaType(); // will be null
>
>        ....
> }
>
> Simply adding a space to the string (i.e. " ") results in the correct
> media type.  This behaviour occurs when I deploy the application on
> Tomcat, but not when run in standalone mode.
>
> I've attached a bare-bones Tomcat webapp demonstrating this behaviour
> and a test case showing that it does not occur when run in standalone mode.
>
> From what I can make out, when the entity is "", getRequestHeaders is
> returning 0 parameters at line 173 of  HttpServerCall (revision 3882)
> but it is not clear to me where the underlying requestHeaders field is
> being populated (or not being).
>
> Regards
>
> Richard Hoberman
>

Reply via email to