users@jsr311.java.net

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

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 19 Sep 2008 09:33:18 -0400

The only thing I could think of to get around this problem is to
subtract the query parameters from the servletRequest.getParameters()
return value within the JAX-RS implementation (if its servlet-based).

Paul Sandoz wrote:
> 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 <http://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
>> <http://web.filter.CacheFilter>
>> - com.opensymphony.clickstream.ClickstreamFilter
>> - org.springframework.web.filter.CharacterEncodingFilter
>> <http://web.filter.CharacterEncodingFilter>
>> - org.displaytag.filter.ResponseOverrideFilter
>> - net.sf.ehcache.constructs.web.filter.GzipFilter
>> <http://web.filter.GzipFilter>
>> - org.appfuse.webapp.filter.LocaleFilter
>> - org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
>> <http://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
>> <mailto: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.
>>
>>
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com