• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Http Methods

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic