This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to build a web application from where file can be uploaded to the server.

the html page looks like as follows:-




The web.xml file looks like:-



I am usging tomcat 6.

I have written a FileUploaderServlet that writes the file to the server's local directory.
The FileUploaderServlet looks as follows:-




Everything works fine and I am even able to get the file on server. But once the doPost() method of the servlet completes, it gives me

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

Any idea where things are going wrong?

 
Marshal
Posts: 67226
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the purpose of the following line in your servlet?
 
nandini lagunia
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops! my bad.

I removed that but the problem persists.
 
Rancher
Posts: 1926
15
Android Eclipse IDE Java Java ME
 
nandini lagunia
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Swastik Dey wrote:May be this helps

http://www.coderanch.com/t/378707/java/java/Http-method-post-not-supported



Hi Swastik,

I have already overridden the doGet and doPost method in the servlet.
 
Swastik Dey
Rancher
Posts: 1926
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nandini,

Just include the <http-method> element inside servlet mapping section, and see if that helps. Do restart the server after making the changes.

 
nandini lagunia
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<servlet-mapping> element in web.xml can contain only <servlet-name> and url-pattern.

The schema doesn't allow me to put http-method tag inside it.
 
Swastik Dey
Rancher
Posts: 1926
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It probably it goes under web resource collection section

http://www.datadisk.co.uk/html_docs/java_app/jboss5/jboss5_securing_web_apps.htm
 
Bear Bibeault
Marshal
Posts: 67226
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is not necessary.

Simply implementing doPost() and not calling the super method should be sufficient.
 
nandini lagunia
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:That is not necessary.

Simply implementing doPost() and not calling the super method should be sufficient.



thanks Bear!

That did the trick.

Would you please tell me why the problem occurs when I make the call to super?
 
Bear Bibeault
Marshal
Posts: 67226
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The super instances of the doXyz methods specifically issue a response that says that the method is not supported!
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!