Issue
I am writing a subclass of HttpServlet
. And I want to have a method in that subclass to get the HttpServletRequest
. However, it seems HttpServlet
does not provide that method.
Is there any way to get round to it?
public class CustomServlet extends HttpServlet {
public HttpServletRequest getRequest() {
...
}
}
Solution
HttpServletRequest is a parameter of methods like doGet(), doPost() etc - how do you think to get it from class?
There is no way to do what you want; you can only override some methods and get HttpServletRequest inside them.
Answered By - Bor Laze