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

Invoking HTTP Methods

 
Paulo Gervásio.
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I understood when the GET and POST methods are called:
POST - by the form HTML and
GET - by the form HTML and query String


But I can't invoke any other method like TRACE, PUT, DELETE, OPTIONS and CONNECT.

How can I invoke these methods in the Servlet?

Thanks.
 
Parth Twari
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paulo,

But I can't invoke any other method like TRACE, PUT, DELETE, OPTIONS and CONNECT.


In the html form
where you write method="POST" in order to call doPost

there in place of POST write any other http method you want to call

ex. method="HEAD"

CONNECT is not supported by servlets. there is no doConnect.

How can I invoke these methods in the Servlet?


In the servlets you can invoke these methods by overriding corresponding doXXX method ex. doTrace()

Regards
 
Paulo Gervásio.
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I try this:

<form action="teste" method="head">


and override the method:



But when a call the servlet it keep calling the doGet method...


Do you know what is happenning?

Thanks
 
Parth Twari
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I looked it up the http form method attribute has only 2 possible values GET,POST

check this out

http://www.w3schools.com/TAGS/att_form_method.asp

So this is the domain of HTTP developer as to how to generate a TRACE http request which will then be handled by corresponding doTrace.

I think that there are specialized programs use for generating HTTP Put,delete etc. requests. They cannot be called using the FORM tag and I hope that , that kind of request generation is not on the exam.

this Post prooves that there are special PUT-Programs
http://www.mail-archive.com/users@tomcat.apache.org/msg18375.html

and so does this
http://www.apacheweek.com/features/put
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavaScript XMLHttpRequest object can be used to create requests using other methods. Java clients using the HttpUrlConnection class or the Apache HttpClient library can do it, too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic