I have uploaded diffrent files, many times with doPost method(in normal servlet and in spring), but i never noticed the fact that we have a method call doPut() whose whole purpose is to put a file on server side but still we never use it.
Any one please put some light on it !!
Thanks for replay, and i agree that http spec is old but if you read the w3c http article, nothing is written that PUT method should not be use or we should avoid to use it.
Actually PUT is still very famous at non-servlet area like REST and MULE(i mean in Web-Service domain) and still the part of HTTP 1.1 and servlet 1.5 spec
Do you have any information why and when not to use PUT method or in other words why to use POST?
PUT requires request parameters been passed through the URL (like as GET). You can't put a file in there.
POST offers roughly the same as PUT but adds some more flexibility, which is the main reason why POST is preferred.
Also keep in mind that some webbrowsers apparently doesn't correctly support PUT.
Just use POST or GET. Use GET for request preprocessing or for idempotent (bookmarkable) requests and use POST for request postprocessing.
The PUT method requests that the enclosed entity be stored under the
supplied Request-URI. If the Request-URI refers to an already
existing resource, the enclosed entity SHOULD be considered as a
modified version of the one residing on the origin server.
Therefore it is incorrect to state that PUT is "not intended to put a full file on server side."
The entry for POST is:
The POST method is used to request that the origin server accept the
entity enclosed in the request as a new subordinate of the resource
identified by the Request-URI in the Request-Line. POST is designed
to allow a uniform method to cover the following functions:
- Annotation of existing resources;
- Posting a message to a bulletin board, newsgroup, mailing list,
or similar group of articles;
- Providing a block of data, such as the result of submitting a
form, to a data-handling process;
- Extending a database through an append operation.
A google search for rfc2616 will get you the full text of Hypertext Transfer Protocol -- HTTP/1.1