use of com.ibm.xsp.context.FacesContextEx in project org.openntf.domino by OpenNTF.
the class PhaseListener method doBeforeEveryPhase.
/**
* Method to run before every phase is triggered
*
* @param arg0
* PhaseEvent currently being run
* @since org.openntf.domino.xsp 2.5.0
*/
private void doBeforeEveryPhase(final PhaseEvent arg0) {
FacesContext ctx = arg0.getFacesContext();
Factory.setClassLoader(Thread.currentThread().getContextClassLoader());
if (ctx instanceof FacesContextEx) {
FacesContextEx ctxex = (FacesContextEx) ctx;
ctxex.addRequestListener(this);
}
}
use of com.ibm.xsp.context.FacesContextEx in project org.openntf.domino by OpenNTF.
the class ODAFacesContextFactory method getFacesContext.
@Override
public FacesContext getFacesContext(final Object context, final Object request, final Object response, final Lifecycle lifecycle) throws FacesException {
FacesContext ctx = _delegate.getFacesContext(context, request, response, lifecycle);
Factory.initThread(ODAPlatform.getAppThreadConfig(null));
Factory.setSessionFactory(new XPageCurrentSessionFactory(), SessionType.CURRENT);
Factory.setSessionFactory(new XPageSignerSessionFactory(false), SessionType.SIGNER);
Factory.setSessionFactory(new XPageSignerSessionFactory(true), SessionType.SIGNER_FULL_ACCESS);
// TODO RPr: This is probably the wrong locale. See ViewHandler.calculateLocale
Factory.setUserLocale(ctx.getExternalContext().getRequestLocale());
Factory.setClassLoader(ctx.getContextClassLoader());
if (ODAPlatform.isAppGodMode(null)) {
ODAFacesContext localContext = new ODAFacesContext(ctx);
attachListener(localContext);
return localContext;
} else {
if (ctx instanceof FacesContextEx) {
attachListener((FacesContextEx) ctx);
return ctx;
} else {
DominoFacesContext localContext = new DominoFacesContext(ctx);
attachListener(localContext);
return localContext;
}
}
}
use of com.ibm.xsp.context.FacesContextEx in project org.openntf.xsp.jakartaee by OpenNTF.
the class AbstractXspLifecycleServlet method service.
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setBufferSize(0);
initializeSessionAsSigner();
FacesContext facesContext = null;
try {
if (!initialized) {
// initialization has do be done after NotesContext is initialized with session to support SessionAsSigner operations
doInit(config);
initialized = true;
}
facesContext = getFacesContext(request, response);
FacesContextEx exc = (FacesContextEx) facesContext;
ApplicationEx application = exc.getApplicationEx();
this.doService(request, response, application);
} catch (NoAccessSignal t) {
throw t;
} catch (Throwable t) {
try (PrintWriter w = response.getWriter()) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
XSPErrorPage.handleException(w, t, request.getRequestURL().toString(), false);
} catch (javax.servlet.ServletException e) {
throw new IOException(e);
} catch (IllegalStateException e) {
// Happens when the writer or output has already been opened
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
} finally {
if (facesContext != null) {
releaseContext(facesContext);
}
}
}
Aggregations