closer look at the FacesServlet instance


This is always ignored as a default servlet that gets generated in the web.xml, but do we know the actual usage of this servlet?

All the JSF applications should include a mapping to this servlet in the deployment Descriptor. The usage of this servlet is that it

  • accepts all the incoming request
  • passes them to the lifecycle for processing
  • intializes the resources

it is usually defined in the web.xml file as

<servlet>
 <display-name>FacesServlet</display-name>
 <servlet-name>FacesServlet</servlet-name>
 <servlet-class>javax.faces.webapp.FacesServlet
 </servlet-class>
 <load-on-startup>1</load-on-startup>
 </servlet>

with corresponding mapping as well

<servlet-mapping>
 <servlet-name>FacesServlet</servlet-name>
 <url-pattern>/faces/*</url-pattern>
 </servlet-mapping>

the servlet includes servlet lifecycle methods to initialize and process the request

init(ServletConfig)FacesContextFactory,LifeCycleFactory is identified and the lifeCycle reference is obtained with the default lifecycle id
service()the pathInfo is manipulated from WEB-INF and META-INF folder from the request, FacesContext is obtained, lifecycle is executed and rendered, later the context is released
destroy()all the instances are destroyed.. technically speaking nullified

1 thought on “closer look at the FacesServlet instance

  1. Ella

    “closer look at the FacesServlet instance | They point the finger at me.
    . again!” was a perfect posting. However, if it had alot more pics it would likely be possibly even far better.
    Take care ,Shad

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s