File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Working with GET and POST Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Working with GET and POST" Watch "Working with GET and POST" New topic

Working with GET and POST

Martin Simpao

Joined: May 25, 2010
Posts: 11

I inherited a ASP classic and Java application. The front end is ASP with Java applets and servlets in the back end. I am trying to set up a test environment in my desktop with the following: Windows XP, Apache Tomcat 5 and IIS. I have taken the code in our development environment and installed it on my desktop. I am able to get it to work partially. I keep getting the following message on trying to start the applet: "Server returned HTTP response code: 405 for URL: http://localhost/TEST/test1/claim."
I am aware that a response code of 405 usually means I am using a POST when I should be using a GET. In IIS I have added POST in some of the verbs associated with certain file extensions such as html, shtml, asp and aspx. This did not do any good, I still keep getting the same message in my out file. It seems in my code the original developers placed connection.setDoOutput(true) which uses POST instead of GET.

I would like to know if there is a way for my application to use GET instead of POST? Is there some setting I can change in Apache Tomcat? Please advise.
Nilesh Miskin
Ranch Hand

Joined: Jun 17, 2010
Posts: 44
I am not familiar with ASP development. But just one advice; if you want your code to use GET instead of POST, why don't you use a hyperlink to invoke a servlet?

Nilesh Miskin
Prashant Hurria
Ranch Hand

Joined: Mar 23, 2009
Posts: 40

It seems the servlet you are using has overridden the doGet Method. What you can is in the HTML form you can make the method="get" or just do not declare any method it takes get by default.
Or you can modify the servlet code to accept Post request as well for that you will have to simply have to override the doPost method and wither copy paste the code there or call another helper method.
Martin Simpao

Joined: May 25, 2010
Posts: 11
It seems the doPost method is set to its default setting, returning a not "allowed message".
I agree. Here's the link:
subject: Working with GET and POST
Similar Threads
can GET but not POST w Tomcat and IIS
Server returned HTTP response code: 405 for URL: http:??? nested exception is:
Uploading file from Tomcat-Aoache server to IIS web server
FTP via web application