tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikola Milutinovic <>
Subject Re: [OT] Re: PUT or POST?
Date Sun, 30 Jul 2006 13:54:35 GMT
> > Apparently our fat client can issue either a POST or a PUT request. The
> > client developer has a slight preference for PUT. I must admit to not
> > being familiar with HTTP PUTs - are there any downside to using PUTs
> > (aside from having to override doPut())?
> I don't think your code will not be any different -- aside from having
> to override the doPut() method in your servlet.
> However, the HTTP spec has rules that are most strict when using PUT;
> you have to respect all of the content-* headers among other things, and
> are required to return a 501 NOT IMPLEMENTED if you do not support such
> options.
> The bottom line is that HTTP PUT appears to have a more robust set of
> options, but you really should implement them properly. HTTP POST will
> allow you to be a bit lazier in your implementation.

It is also a question of semantics. If the technical side is the same, then let us communicate
our intentions clearly.

GET - request which will not change the state of the server side (a.k.a. idempotent method).
Used for querying server side.
POST - request that will change the state of the server side. Used for submitting data to
the server side.
PUT - request that will create an object on the server side, accessible via the given URL.
Used for object upload.
DELETE - delete an an object from the server URL space.

So, one could argue that POST and PUT have similar semantics. They both send data to the server
and expect the state of the server side to change. However, PUT is more oriented to the pre-web
app era and more inclined to notions of manipulating static content. POST is more inclined
to web applications and to notions of submitting data to be processed.

If you expect that crash data will create an object, real or virtual, that will be accessible
via the URL you will provide for PUT method, then PUT seams like a good choice. If you are
submitting data and some other object may come to exist (like crash report) or not, as a result
of that data submission, then POST is a more proper choice.


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message