wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes [IMP]Whydoes it give 403 Method not found exception..?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "[IMP]Whydoes it give 403 Method not found exception..??" Watch "[IMP]Whydoes it give 403 Method not found exception..??" New topic
Author

[IMP]Whydoes it give 403 Method not found exception..??

deepanjan Dey
Greenhorn

Joined: Jan 23, 2008
Posts: 2
Hi,

Why do we get 403 Method not found exception for servlet if we don't override doPost/doGet method in our servlet and declare method = POST/GET in jsp.

Why does it not call the doGet/doPost method of Parent class HttpServlet.
Please reply.

Regards,
Deepanjan
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Isn't 403 a "Forbidden" code?

I think the code for a method not supported is a 405.


A good workman is known by his tools.
deepanjan Dey
Greenhorn

Joined: Jan 23, 2008
Posts: 2
But why we get that error..??

Why does it not call the doGet/doPost method of Parent class HttpServlet..??

Regards,
Deepanjan
Rhett Wang
Greenhorn

Joined: Apr 03, 2008
Posts: 12
They are like this:

protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
String protocol = req.getProtocol();
String msg = lStrings.getString("http.method_post_not_supported");
if (protocol.endsWith("1.1")) {
resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg);
} else {
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
}
}

SC_METHOD_NOT_ALLOWED-----405
SC_BAD_REQUEST------------400

code 403 should be brought by other things.


SCBCD in progress<br />SCWCD 5 (May 2008)<br />SCJP 2 (Aug 2001)
 
 
subject: [IMP]Whydoes it give 403 Method not found exception..??
 
Similar Threads
doPost(), doGet()
POST or GET
please reply urgently!!!
is servlet doGet and doPost method are threadsafe?
why we should not override service() method in a servlet