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 method POST is not supported by this URL

 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a query about HttpServlet class. If my servlet does not override doPost() method and a POST request is send to the servlet, why does it throw method not supported exception? Does it comply to servlet specification? Or is it specific to implementation?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's more a container specific thing, so it's not in the servlets spec. The container could do something in HttpServlet's doPost, but do what ?
I think it's better to do nothing and throw a 405 error.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javadocs for HttpServlet should really state that the default implementations of the doXYZ methods send errors in response. As it is, they assume that a method that has not been overridden is not going to be called, which -as you found out- is not generally the case.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is an explanation for a similiar kind of a thing in the HFSJ book and it is very straightforward. I forgot the page number, I remember seeing it somewhere in the 3 chapter...
 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure about one thing, who is responsible for providing the interface/class defined in the API/Spec. Does not Sun provide HttpServlet class?
[ April 11, 2007: Message edited by: Tridib Samanta ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic