The utility class generates random logging messages.
The Applet passes data to the servlet in onMigrate() method.
The Servlet instantiates a new DummyLogger and gets some messages.
The Servlet then passes the log messages back to the Applet.
The Applet uses a timer to wake up, checks if there's a new log message and then displays them in it's text area.
When I use the doGet() in the servlet, the code works only if I create a new URLConnection object everytime in the run method.
When I use the doPost() method the following exception is thrown:
What am I doing wrong?
I read all over the web that one need to include the method that's causing an HTTP 405 error, in the response's "Allow" header. Isn't that the ServletContainer's job (setting response headers). I did try the following two ways, but neither worked:
How do I get this to work?
I'm now going to attach the code for my app, apologies for the long code/ For the sake of simplicity - I have omitted the complex logging logic (as it used other classes also) but just using System.set/getProperty(new java.util.Date()); to simulate 50 different log messages.
[ September 07, 2007: Message edited by: Prashant Sehgal ] [ September 09, 2007: Message edited by: Prashant Sehgal ]
Hello, you need to implement doPost in your servlet. The 405 is saying that the servlet does not support the POST method.
Joined: Jun 20, 2003
Well, I've tried both. doPost() also throws the same error. The whole idea of giving the entire code here was so that someone could try running/deploying this.
Joined: Sep 07, 2007
Not clear what you mean by tried both, but run this simple sample servlet. Run this servlet. In IE you will see a message that says "HTTP 405 - Resource not allowed" and in Firefox, the message is a bit clearer: "Error 405: HTTP method GET is not supported by this URL" Looking back at the code you will see that this servlet does not implement doGet. If you were to add the doGet method, it would work fine. Your code as the same problem; if your applet uses an HTTP POST method, the container will return the 405 error as you haven't implemented doPost.