users@jersey.java.net

Faking PUT, etc. over POST

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Tue, 13 Apr 2010 16:09:02 -0400

I'm curious about taking in a form submission from a browser that is
*logically* supposed to be a PUT operation but that comes in as a
POST.

Paul writes here
(http://n2.nabble.com/Servlet-Filter-Jersey-JAXB-issues-tp723588p723687.html)
that "Jersey has server side filters and there is a filter that will
support what you require." He's talking about a similar issue--a
virtually identical issue, actually.

Briefly, it looks like perhaps? out of the box? if there's a
particular HTTP header present that identifies the "real" HTTP method,
then before Jersey's routing gets involved, it will behave as though
that method had really been specified.

That's all fine and good, but I don't know of a way to write an HTML
form, for example, that would set such a header.

Rails (which I know next to nothing about) seems to handle this by
reserving a hidden form variable--if it is present ("_method", I
think) then the Rails controller piece will intercept it and use it to
determine the proper HTTP method to use while routing.

Is there something similar to this in Jersey by default? I would love
to let my resources handle @PUTs for updates where a URI is known
ahead of time in keeping with
http://www.elharo.com/blog/software-development/web-development/2005/12/08/post-vs-put/,
among others.

Thanks,
Laird