I am writing a Servlet that retrieves request parameters but needs to use them in the init
method. Since the init
method would be called before the doGet
method and since the init
method does not have a HttpServletRequest
object as an argument, I don't know how to get the request parameters.
public class OpenIdServlet extends HttpServlet
{
...
...
private OpenIdManager manager;
@Override
public void init() throws ServletException
{
super.init();
manager = new OpenIdManager();
manager.setRealm("http://localhost:8080/OpenIDSample");
manager.setReturnTo("http://localhost:8080/OpenIDSample/openid"); //I need to append the value of a request parameter here...
}
...
...
}
So the question is: is there any way I can get HttpServletRequest
parameters in the init()
method of a servlet? If no what other better approach can one use to solve this problem? Thanks.
OpenIdManager
comes from.