public void service(ServletRequest request,
ServletResponse response) throws IOException, ServletException {
boolean hasFacesContext = false;
FacesContext context = FacesContext.getCurrentInstance();
// If we happen to invoke the ResourceServlet *via* the
// FacesServlet, you get a lot of fun from the recursive
// attempt to create a FacesContext. Developers should not
// do this, but it's easy to check
if (context != null)
{
hasFacesContext = true;
}
else
{
Configurator.disableConfiguratorServices(request);
//=-= Scott O'Bryan =-=
// Be careful. This can be wrapped by other things even though it's meant to be a
// Trinidad only resource call.
context = _facesContextFactory.getFacesContext(getServletContext(), request, response, _lifecycle);
}
try
{
super.service(request, response);
}
catch (ServletException e)
{
_LOG.severe(e);
throw e;
}
catch (IOException e)
{
if (!_canIgnore(e))
_LOG.severe(e);
throw e;
}
finally
{
if (!hasFacesContext)
context.release();
}
}
|