Hi guys,

I remember someone reporting a similar issue recently. It is due to a design 
choice in the Servlet API. The getParameter() method on
ServletRequest does consume the input stream if there is a POSTed form (your 
case):
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getParameter(java.lang.String)

>From my point of view, the only solution for you is to make sure you don't 
>rely on this getParameter() method. Couldn't you
re-implement your Servlet filter as a Restlet filter?

In Restlet, the getEntityAsForm() method can automatically cache the result 
form for reuse down the chain.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Thierry Boileau [mailto:[email protected]] 
Envoye : jeudi 12 fevrier 2009 18:19
A : [email protected]
Objet : Re: Restlet Servlet adapter with Tomcat

Hello,

it sounds like the incoming stream is fully consumed by the servlet 
container...
You can check this by accessing the  servlet request via your own 
servlet adapter.
Just add a new class that overrides 
"com.noelios.restlet.ext.servlet.ServerServlet " and update the web.xml 
file as follow:

         <servlet>
                 <servlet-name>ServerServlet</servlet-name>
                 <servlet-class>your class</servlet-class>
         </servlet>

You will have access to the service(request, response), and then you can 
inspect the request object.

Note that this may a be a bug from Restlet. Could you have a look at the 
servlet request object and tell us what happens?

best regards,
Thierry

> We are using the restlet servlet adapter to integrate Restlet with Tomcat.
>
> We have a top level servlet filter which checks each request to see if:
>
> (1) it is a POST
> (2) it contains a certain form parameter
>
> If either of these is not true, we simply forward the request-response pair 
> down the chain.
>
> The problem is that when we user HttpServletRequest.getParameter in the 
> servlet filter, it seems to modify the request somehow so
that when we do a Request.getEntityAsForm (down in the Restlet layer), we get a 
blank form.
>
> Does anyone know why this might be occurring?
>
> Thanks a lot.
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1136361
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1146225

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1149688

Reply via email to