I have a servlet which is having only doGet(...); in the form when i specify POST and submit it, it will throw me an exception saying POST() is not supported by this URL. When i specify any other Http methods like PUT,DELETE,OPTIONS,TRACE in the form method ,it will not throw any exception instead it gives behaviour of doGET(). Why exceptions are not thrown for these methods like POST method.
I have checked the HttpServletjava code there is a default implementation for HEAD,OPTIONS and TRACE.for GET,POST,PUT,DELETE the implementation is same that is it will send an error message back to client using res.sendError(int,String); method.So at least for PUT and DELETE methods this should throw the exception.
[ December 08, 2008: Message edited by: raja ram ] [ December 08, 2008: Message edited by: raja ram ]
In a typical HTML file, you can specify GET and POST methods only! Other types (PUT,DELETE,TRACE,HEAD...) are for the purposes of testing and some other special implementations, as you can see here. That means, you cannot send a PUT, DELETE, TRACE,... request just by using a plain-old HTML file.
In other words,
is same as to,
Both of the above invocation sends a HTTP GET request to the web server, because GET is the default type for 'unknown' types, while "DELETE" and "djfjdshk" are unknown for HTML.
Its true, only GET and POST are valid for HTML.rest all of them are meaning less and will be taken as default that is GET.I checked it by putting request.getMethod() it does print GET method for DELETE,OPTIONS,TRACE,....
Thanks for the info it cleared my doubt.
Thanks [ December 11, 2008: Message edited by: raja ram ]