Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Http Methods

 
Tha�s Manfrim Firmino
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!
I was trying to test some http methods besides get and post and I found out I don�t know how to use them!
Can someone give me an example of jsp using head, trace, put, delete or connect option?

thanks in advance,
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your options for html forms are GET and POST.

Keep in mind that the methods are HTTP methods, not HTML methods. HTTP is bigger than just browserworld and things other than browsers can make a request to a servlet.

Trying to place the other methods into JSPs is like fitting a square peg in a round hole.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But you could write a client with a library like Jakarta Commons HttpClient, which does support the other methods. HEAD I think is the same as GET, except it only retrieves the HTTP headers, not the body. And even though they may not be interesting for JSP pages, a servlet might do something with them. That's why HttpServlet has doXYZ methods for all of them.
 
Sathish Nagappan
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So Can I put it this way ??

If I were to have a form such as :

<form action="\RationalServlet.do" method="HEAD (or) TRACE (or) OPTIONS">
.
.
.
.
</form>

Then the method that is gonna get invoked on the RationalServlet is GET ??
 
Tha�s Manfrim Firmino
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don�t think so..that�s the reason I posted this question...I tried to do the same that you but the servlet called doGet() - that�s the default option - for all of them.
Thank you guys for the answers!
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Marc said, only GET and POST work with HTML forms. But there is a lot more to HTTP than carrying HTML forms. The HTTP standard has more detail on how the other methods can be used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic