org.esupportail.commons.web.servlet
Class FacesServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.esupportail.commons.web.servlet.FacesServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FacesServlet
extends javax.servlet.http.HttpServlet

A JSF-based servlet that catches exception and gives them to an exception service. see Javadoc of JSF Specification

See Also:
Serialized Form

Field Summary
private static java.lang.String DEFAULT_DEFAULT_VIEW
          The default default view.
private static java.lang.String DEFAULT_REDIRECTOR_NAME
          The default name of the redirector.
private static java.lang.String DEFAULT_VIEW_PARAM
          The name of the servlet parameter that gives the name of the redirector.
private  java.lang.String defaultView
          The default view.
private  javax.faces.context.FacesContextFactory facesContextFactory
          The context factory.
private  javax.faces.lifecycle.Lifecycle lifecycle
          The lifecycle.
private  Logger logger
          A logger.
private static java.lang.String REDIRECTOR_NAME_PARAM
          The name of the servlet parameter that gives the name of the redirector.
private  java.lang.String redirectorName
          The name of the redirector.
private static long serialVersionUID
          The id for serialization.
private static java.lang.String SERVLET_INFO
          The servlet info.
 
Constructor Summary
FacesServlet()
          Constructor.
 
Method Summary
protected  void catchException(java.lang.Exception exception, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Catch an exception.
protected  void checkVersion()
          Check the version of the application and throw a ConfigException if the servlet can not be executed (for instance if the version of the application and the one of the database do not match).
 void destroy()
           
private  java.lang.String getLifecycleId()
           
private  java.util.Map<java.lang.String,java.lang.String> getParams(javax.servlet.http.HttpServletRequest request)
           
private  DeepLinkingRedirector getRedirector(javax.faces.context.FacesContext facesContext)
           
 java.lang.String getServletInfo()
           
private  void handleExceptionHandlingException(java.lang.Exception e)
          Wrap exceptions thrown when already catching an exception.
 void init(javax.servlet.ServletConfig servletConfig)
           
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DEFAULT_VIEW

private static final java.lang.String DEFAULT_DEFAULT_VIEW
The default default view.

See Also:
Constant Field Values

DEFAULT_REDIRECTOR_NAME

private static final java.lang.String DEFAULT_REDIRECTOR_NAME
The default name of the redirector.

See Also:
Constant Field Values

DEFAULT_VIEW_PARAM

private static final java.lang.String DEFAULT_VIEW_PARAM
The name of the servlet parameter that gives the name of the redirector.

See Also:
Constant Field Values

defaultView

private java.lang.String defaultView
The default view.


facesContextFactory

private javax.faces.context.FacesContextFactory facesContextFactory
The context factory.


lifecycle

private javax.faces.lifecycle.Lifecycle lifecycle
The lifecycle.


logger

private final Logger logger
A logger.


REDIRECTOR_NAME_PARAM

private static final java.lang.String REDIRECTOR_NAME_PARAM
The name of the servlet parameter that gives the name of the redirector.

See Also:
Constant Field Values

redirectorName

private java.lang.String redirectorName
The name of the redirector.


serialVersionUID

private static final long serialVersionUID
The id for serialization.

See Also:
Constant Field Values

SERVLET_INFO

private static final java.lang.String SERVLET_INFO
The servlet info.

See Also:
Constant Field Values
Constructor Detail

FacesServlet

public FacesServlet()
Constructor.

Method Detail

catchException

protected void catchException(java.lang.Exception exception,
                              javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.servlet.ServletException,
                              java.io.IOException
Catch an exception.

Parameters:
exception -
request -
response -
Throws:
javax.servlet.ServletException
java.io.IOException

checkVersion

protected void checkVersion()
                     throws ConfigException
Check the version of the application and throw a ConfigException if the servlet can not be executed (for instance if the version of the application and the one of the database do not match).

Throws:
ConfigException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet
See Also:
Servlet.destroy()

getLifecycleId

private java.lang.String getLifecycleId()

getParams

private java.util.Map<java.lang.String,java.lang.String> getParams(javax.servlet.http.HttpServletRequest request)
Returns:
the parameters of the current request.

getRedirector

private DeepLinkingRedirector getRedirector(javax.faces.context.FacesContext facesContext)
Returns:
the redirector

getServletInfo

public java.lang.String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet
See Also:
Servlet.getServletInfo()

handleExceptionHandlingException

private void handleExceptionHandlingException(java.lang.Exception e)
                                       throws javax.servlet.ServletException,
                                              java.io.IOException
Wrap exceptions thrown when already catching an exception.

Throws:
javax.servlet.ServletException
java.io.IOException

init

public void init(javax.servlet.ServletConfig servletConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException
See Also:
Servlet.init(javax.servlet.ServletConfig)

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
HttpServlet.service( javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)