I'm updating a regular Servlet to a Spring kind Servlet. To accomplish this I followed these instructions that say I should implement HttpRequestHandler
. That's great and works for my Servlet because right now I only call it using POST method.
But now I'm curious about what happens if I want to implement the GET method too. In a regular Servlet I have:
public class MyServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
...
protected void doGet(HttpServletRequest request, HttpServletResponse response)
...
protected void doPost(HttpServletRequest request, HttpServletResponse response)
...
}
But when implementing HttpRequestHandler I have:
public class MyServlet implements HttpRequestHandler {
...
public void handleRequest(HttpServletRequest request, HttpServletResponse response)
...
}
Reading the official documentation it says that it only supports POST by default, but couldn't find a way to implement GET. Other answer here gave me an idea of using a Controller that could receive a GET request and then call the HttpRequestHandler
, but that didn't seemed very neat to me.
Can anyone tell me if it is possible and how do I do it? If possible reference some docs :)