• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doTrace in HttpServlet

 
sasikumar palakkizhi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1. I used a file "form.html" and a java file "BeerSelect.java" for understanding the working of HTTP requests. When I overrided doTrace only in the HttpServlet in my class file, and requested for a resource using "PUT" method from an html file, i got a message that HTTP method Get is not supported by the URL.

2. Also I overrided doHead method only and used a form submission method of HEAD, I got the same message " HTTP method Get is not supported by the URL"

What are the reasons for this.

The code used for the second case is shown below( relevant parts)



The servlet is properly configured in web.xml and is working when i set both the methods as get.

Thanks in advance

Sasikumar
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "method" property of the form tag does not just get passed verbatim to the server.

Html forms support 'get' and 'post'.
If it wasn't 'post' in your form, the browser most likely sent it as a 'get' request.

Running LiveHTTPHeaders while posting your form will show you exactly what method is being employed.
 
sasikumar palakkizhi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben,

Thanks for the help... using ieHTTPHeaders, i could understand that internet explorer generates only get and post requests irrevelent of the actual method i used in the form.

another point... does that mean ... we should have a client application rather than browser if we want to use put,head,trace and option methods?

thanks .. once again for the immediate help

sasikumar
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your listed methods are also HTTP methods. But nobody use those usually. Client application would be the browser but the element would be something else not the <form>.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, those methods aren't used by browsers.

WEBDAV clients use doPut.
I imagine the, lightweight, doHead could be useful if you had an applet or other client side code that needs to poll a server often (Head requests don't return the body).
 
sasikumar palakkizhi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the immediate answers to adeel and ben...

regards
sasikumar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic