-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andre,

On 9/20/2010 6:34 AM, Andre Juffer wrote:
> Could it be true that Jetty (the one that comes with cocoon is 6.1.7, a
> rather old one) is actually not supporting the getParameters() family
> of methods when the HTTP request method is PUT?

This almost certainly the case: the servlet specification only requires
that getParameter handle request-body data under certain conditions.
- From the 2.5 version of the spec, section SRV.3.1.1:

"
The following are the conditions that must be met before post form data
will
be populated to the parameter set:
1. The request is an HTTP or HTTPS request.
2. The HTTP method is POST.
3. The content type is application/x-www-form-urlencoded.
4. The servlet has made an initial call of any of the getParameter
family of methods on the request object.
"

So, when you use PUT, you don't get parameters in the usual way: you'll
have to parse them yourself in some way.

You might want to refer to this thread on the Tomcat-User mailing list
for an extended discussion: http://markmail.org/thread/kinlccrweiaesqoh

Note that parameters placed into the URL are always available via
request.getParameter*

There are several ways you could get your server to extract request-body
PUT parameters and make them available via the getParameter* family of
methods. One such way (which would avoid having to do anything nasty
within Cocoon itself) would be to write a request Filter that overrides
getParameter* and parses a request body if it is a PUT request.

I have philosophical issues against doing such a thing because I feel
that PUT was designed to put a copy of the entire request body into the
URL used to access it, not to pass some complex set of "parameters" in
the body itself to do something else. But, that's not really for me to
decide on your behalf: if you want POST behavior from PUT, you'll likely
have to code it yourself in some way. I can give you some suggestions if
you would like to take this route.

> I came across some comments that Tomcat (did not mention which version
> of Tomcat) is also not supporting the getParameters() famility of
> methods [1]. Tomcat can actually handle PUT, POST etc requests, but
> blocks them by default [2].
> 
> Anyone can confirm this?

I can: Tomcat's DefaultServlet (the servlet that responds to all request
that aren't otherwise handled by other servlets) rejects PUT (and POST)
requests, but you don't want the DefaultServlet to accept them anyway:
you want your REST-processing code to handle them. Tomcat will not
interfere with any servlet that expects to accept a PUT request.

All Tomcat versions should behave this way, as the servlet specification
has been (relatively) consistent across the versions covered by Tomcat
implementations.

Your first problem, though, was that request.getMethod was always
returning "GET" even when the method should be "PUT", right?

Can you show us how you have configured your pipepine (including how you
extract the "method" from the request) and also how you are declaring
and then using the method in your XSLT?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyXmPgACgkQ9CaO5/Lv0PD58ACguAHmp+VXpHeSwCHmdjGDz/95
4FwAoLkyYpHW3gxn0alEdEeNEtjYyFEz
=j9hU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org

Reply via email to