users@jsr311.java.net

Re: x-www-form-urlencoded Content Type and rest WS

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 19 Sep 2008 09:48:38 +0200

Hi Denis,

Wow! that is a lot of filters. I would need to see the source code of
the filters to check for calls to the method that gets parameters.
The annoying things is because there is no distinction between query
and form parameters a filter might legitimately think it is operating
on query parameters then in fact they are not.

The only think i can suggest is a hack to work around this and have a
another filter at the end that re-encodes any form parameters as the
entity of the request.

Paul.

On Sep 18, 2008, at 6:11 PM, Denis wrote:

> Hi all,
>
> Thanks to Paul, I finally figure out why my input stream was
> consumed before reaching JAX-RS.
> Actually, I'm using AppFuse for my project and it adds a lot of
> filter in the web.xml.
> I tried to deploy my app without any filters and it worked!!!!!
> Here's the list of filter based on AppFuse:
> - com.opensymphony.oscache.web.filter.CacheFilter
> - com.opensymphony.clickstream.ClickstreamFilter
> - org.springframework.web.filter.CharacterEncodingFilter
> - org.displaytag.filter.ResponseOverrideFilter
> - net.sf.ehcache.constructs.web.filter.GzipFilter
> - org.appfuse.webapp.filter.LocaleFilter
> - org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
> - org.acegisecurity.util.FilterToBeanProxy
> - com.opensymphony.module.sitemesh.filter.PageFilter
> - org.appfuse.webapp.filter.StaticFilter
> - org.apache.struts2.dispatcher.ActionContextCleanUp
> - org.apache.struts2.dispatcher.FilterDispatcher
>
> One of these filter is not working with JAX-RS and especially with
> x-www-form-urlencoded content...
>
> Hope that helps
>
> Denis
>
>
>
> On Wed, Aug 20, 2008 at 2:25 PM, Denis <deniak.nospam_at_gmail.com>
> wrote:
> Hi Paul,
>
> I just checked my Tomcat configuration file (server.xml) and I
> don't have any valves registered
> but I was able to get my parameters using Servlet.getParameter*.
>
> As you said and according to the Servlet.getParameter result, the
> body of the request must be consumed
> before.
> Do you have any idea when and where it's consumed?
> It's really strange. Here's what I found in the ServletRequest
> javadoc:
>
> If the parameter data was sent in the request body, such as occurs
> with an HTTP POST request, then reading the body directly via {_at_link
> #getInputStream} or {_at_link #getReader} can interfere
> with the execution of this method.
>
> By the way, thanks for your help.
>