On 13 mai, 02:30, David Whitehurst <[email protected]> wrote:
> I'm using the Struts2 REST Plugin and I have an issue where I cannot
> get the PUT REST URL to work. I've posted to the correct list (Struts
> user) for any insight in how I'm using the plugin, however, even the
> plugin doesn't handle the HTTP PUT in the manner that I would expect
> it to be coded. E.g. the REST URLs given in the Struts examples are
> logical, however the PUT is handled using a parameter _method=put.
> I've also looked for methods on RequestBuilder and only GET and POST
> are available.
This is because Safari 2 used to only support GET and POST. It seems
there are (old?) proxies and firewalls out there that only accepts
GETs and POSTs.
The workaround is to call the protected constructor through the use of
a subclass; e.g. using an anonymous subclass (if you do PUTs at
several places in your code, consider re-using a named subclass
instead of creating an anonymous one at each call-point):
RequestBuilder rb = new RequestBuilder("PUT", url) { }
> Has anyone used REST with GWT with success and minimal coding? If so,
> please respond.
We're using a POST request with an X-HTTP-Method-Override request
header, à la GData, for our PUTs. This was pretty straightforward for
us as we have a helper class that creates the RequestBuilders and
hides the details (this is used to catch 401s and show a "you've been
logged out, please sign in again" screen, and add authentication
credentials to all requests). In our case, the RequestBuilder is not
exposed at all outside this helper class, because we do not have a
need to tweak the request headers on a by-request basis; but it could
easily be done without much change to our code.
So, yes we're using "REST with GWT with success and minimal coding".
(note that we do not use Struts2 on the server side)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---