Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception

 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to remove this exception


HTTP Status 405 - HTTP method POST is not supported by this URL

--------------------------------------------------------------------------------

type Status report

message HTTP method POST is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).


--------------------------------------------------------------------------------

Apache Tomcat/6.0.32

i have removed it.
 
Prasad Krishnegowda
Ranch Hand
Posts: 667
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do not have doPost() method overridden in your servlet, but you access the servlet with POST method, that's the reason why this exception is coming. To overcome this exception, override doPost() method or do not call this servlet with POST method..
 
Anurag Verma
Ranch Hand
Posts: 167
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside your servlet, if you have goGet() method & if you want to support GET & POST both, then add following code inside your class -

 
Tim Moores
Bartender
Posts: 2803
41
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not use GET and POST interchangeably, the HTTP specification is very clear about that. The "solution" mentioned by Anurag Verma is thus not viable.
 
Prasad Krishnegowda
Ranch Hand
Posts: 667
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anurag Verma wrote:Inside your servlet, if you have goGet() method & if you want to support GET & POST both, then add following code inside your class -


Having both doGet() and doPost() do the same thing is not a good practice. They both are there for different purposes.
 
Anurag Verma
Ranch Hand
Posts: 167
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasad,
This is already mentioned -
if you want to support GET & POST both, then add following code


i know this is not good way, but if someone needs it, then this is the way
 
Tim Moores
Bartender
Posts: 2803
41
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no way this is ever "needed" - it can easily be avoided by various means. And as pointed out already, it violates the HTTP spec, with all the adverse consequences that can have. So you should never advocate it.
 
Anurag Verma
Ranch Hand
Posts: 167
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic