Seam 2 how to get servletcontext?

I'm in seam 2. How can I get the servlet context?

I can do this: ServletContexts servletContexts = ServletContexts.getInstance ();

But this is not a ServletContext.

+4
source share
1 answer

At what point are you trying to get the ServletContext :

  • At the time of the request, HttpServletRequest : ServletContexts.instance().getRequest().getServletContext() .

  • At the time of the JSF request: (ServletContext)FacesContext.getCurrentInstance().getExternalContext() .

  • At application startup: ServletLifecycle.getServletContext() .

+9
source

All Articles