Hi there,

Looking at the Servlet API, the behavior that you describe seems normal:
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getParameter(java.lang.String)

If you call this method in your Servlet filter, it will consume the request 
input stream and the Restlet won't have a way to read it
again. Can't you implement the same filter as a Restlet filter instead?

Note that if you need the query parameters, then you can still call 
getResourceRef().getQueryAsForm();

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 : [email protected] [mailto:[email protected]] 
Envoye : samedi 10 janvier 2009 22:58
A : [email protected]
Objet : Servlet Filter using request.getParameter loses Form data

We added servlet filter to our application which calls 
request.getParameter("name"). That breaks Restlet Form handling.
request.getEntityAsForm() will return empty form.

It seems that getParameter interferes with getInputStream in the case form data 
is sent using POST. To me this sounds to be a bug in
Restlet framework. We are using Restlet 1.1.1.

This simple filter will break getEntityAsForm:

public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain) throws IOException, ServletException {
  request.getParameter("name");
  chain.doFilter(request, response);
}

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

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

Reply via email to