struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Milanovic" <alex.milano...@iogeo.com>
Subject REST, response body for HTTP PUT
Date Mon, 01 Dec 2008 18:32:01 GMT
Hi All,

I want to return a response JSON for HTTP PUT requests using the REST
plugin (2.1.3). Although the request succeeds (i.e. the DB is updated
as expected) the "model" object does not get serialized to JSON. The
same approach works well for HTTP POST and create() method. Is HTTP
PUT supposed to not have a response (in general and/or in the REST
plugin)?

I noticed the following sequence of method invocations for both PUT
and POST in the corresponding model-driven REST Controller:

1. Twice getModel(), both times the model object is present but not
populated (its data fields are null)
2. Once update() or create() for PUT or  POST, respectively
3. Twice getModel(), both times the model is populated (it was
populated earlier in the update/create)

The difference is that for POST the model is returned to the client
whereas for PUT it is not.

Thanks,
Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message