Different ways to get Servlet Context

Viewed 46555

Could anybody explain me what is the difference between this ways of getting the ServletContext of an HttpServlet?

doGet( HttpServletRequest request, ... ){
    getServletConfig( ).getServletContext( );
    request.getSession( ).getServletContext( );
    getServletContext( );
}

Is there any difference in performance or in the context itself? If so, which is the best way? Are there any other way of retrieving the context?

1 Answers
Related