Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP method GET is not supported by this URL

I'm calling servlets which has implemented CometProcessor interface, and whenever I try to call the servlets with get request, I'm getting the above error. May I know the reason?

public class ChatServlets 
    extends HttpServlet implements CometProcessor { 

 public void event(CometEvent event) 
    throws IOException, ServletException {
    HttpServletRequest request = event.getHttpServletRequest();
    HttpServletResponse response = event.getHttpServletResponse();
    if (event.getEventType() == CometEvent.EventType.BEGIN) {
        response.getWriter().println("Welcome ");
    } else if (event.getEventType() == CometEvent.EventType.READ) {
            response.getWriter().println("Bye");
    }
    }
}
like image 593
Alvin Avatar asked Nov 14 '22 10:11

Alvin


1 Answers

From this document:

IMPORTANT NOTE: Usage of these features requires using the APR or NIO HTTP connectors. The classic java.io HTTP connector and the AJP connectors do not support them.

By default you get classic java.io HTTP connector configured in your server.xml. Have you changed it to NIO connector?

like image 156
Georgy Bolyuba Avatar answered Dec 14 '22 19:12

Georgy Bolyuba