@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
LifecycleFactory lFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Lifecycle lifecycle = lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
FacesContextFactory fcFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
FacesContext facesContext = fcFactory.getFacesContext(getServletContext(), request, response, lifecycle);
try {
// invoke application
String outcome = invokeApplication(facesContext);
if (facesContext.getResponseComplete()) {
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("outcome = '" + outcome + "'");
}
Application application = facesContext.getApplication();
if (facesContext.getViewRoot() == null) {
facesContext.setViewRoot(createViewRoot(facesContext));
}
NavigationHandler navigationHandler = application.getNavigationHandler();
navigationHandler.handleNavigation(facesContext, null, outcome);
lifecycle.render(facesContext);
} finally {
facesContext.release();
}
}