Java Code Examples for javax.faces.event.PhaseId#RENDER_RESPONSE
The following examples show how to use
javax.faces.event.PhaseId#RENDER_RESPONSE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UndefinedExceptionHandler.java From library with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} * * @param context * @param exception */ @Override public void handle(FacesContext context, Throwable exception) { final HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); request.setAttribute(ERROR_EXCEPTION + "_stacktrace", exception); if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(exception); } request.setAttribute(ERROR_EXCEPTION_TYPE, exception.getClass().getName()); request.setAttribute(ERROR_MESSAGE, exception.getMessage()); request.setAttribute(ERROR_REQUEST_URI, request.getHeader("Referer")); request.setAttribute(ERROR_STATUS_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); final String errorPage = this.getErrorPage(exception); context.getApplication().getNavigationHandler().handleNavigation(context, null, errorPage); context.renderResponse(); }
Example 2
Source File: UndefinedExceptionHandler.java From web-budget with GNU General Public License v3.0 | 6 votes |
/** * {@inheritDoc} * * @param context * @param exception */ @Override public void handle(FacesContext context, Throwable exception) { final HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); request.setAttribute(ERROR_EXCEPTION + "_stacktrace", exception); if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(exception); } request.setAttribute(ERROR_EXCEPTION_TYPE, exception.getClass().getName()); request.setAttribute(ERROR_MESSAGE, exception.getMessage()); request.setAttribute(ERROR_REQUEST_URI, request.getHeader("Referer")); request.setAttribute(ERROR_STATUS_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); final String errorPage = this.getErrorPage(exception); context.getApplication().getNavigationHandler().handleNavigation(context, null, errorPage); context.renderResponse(); }
Example 3
Source File: BusinessLogicExceptionHandler.java From library with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * @param context * @param exception */ @Override public void handle(FacesContext context, BusinessLogicException exception) { if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(exception); } final String i18nMessage = MessageSource.get(exception.getMessage()); FacesUtils.clearMessages(context); Messages.add(FacesMessage.SEVERITY_ERROR, null, i18nMessage, exception.getParameters()); context.renderResponse(); }
Example 4
Source File: BridgeExceptionHandlerWrapper.java From deltaspike with Apache License 2.0 | 5 votes |
@Override public void processEvent(SystemEvent event) throws AbortProcessingException { //handle exceptions which occur in a phase-listener (beforePhase) for PhaseId.RENDER_RESPONSE //needed because #handle gets called too late in this case if (event instanceof ExceptionQueuedEvent) { ExceptionQueuedEvent exceptionQueuedEvent = (ExceptionQueuedEvent)event; FacesContext facesContext = exceptionQueuedEvent.getContext().getContext(); if (facesContext.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE && exceptionQueuedEvent.getContext().inBeforePhase()) { Throwable exception = getRootCause(exceptionQueuedEvent.getContext().getException()); if (exception instanceof AccessDeniedException) { processAccessDeniedException(exception); } else { ExceptionToCatchEvent exceptionToCatchEvent = new ExceptionToCatchEvent(exception); exceptionToCatchEvent.setOptional(true); this.beanManager.fireEvent(exceptionToCatchEvent); if (exceptionToCatchEvent.isHandled()) { return; } } } } super.processEvent(event); }
Example 5
Source File: MessageHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
/** * Handle a notification that the processing for a particular phase of the * request processing lifecycle is about to begin. */ public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 6
Source File: MessageHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
/** * Handle a notification that the processing for a particular phase of the * request processing lifecycle is about to begin. */ public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 7
Source File: ConstraintViolationExceptionHandler.java From web-budget with GNU General Public License v3.0 | 5 votes |
/** * {@inheritDoc} * * @param context * @param exception */ @Override public void handle(FacesContext context, Throwable exception) { if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(exception); } FacesUtils.clearMessages(context); Messages.add(FacesMessage.SEVERITY_ERROR, null, MessageSource.get("error.core.constraint-violation")); context.renderResponse(); }
Example 8
Source File: MessageHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
/** * Handle a notification that the processing for a particular phase of the * request processing lifecycle is about to begin. */ public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 9
Source File: ConstraintViolationExceptionHandler.java From web-budget with GNU General Public License v3.0 | 5 votes |
/** * {@inheritDoc} * * @param context * @param exception */ @Override public void handle(FacesContext context, Throwable exception) { if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(exception); } FacesUtils.clearMessages(context); Messages.add(FacesMessage.SEVERITY_ERROR, null, MessageSource.get("error.core.constraint-violation")); context.renderResponse(); }
Example 10
Source File: MessageHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
/** * Handle a notification that the processing for a particular phase of the * request processing lifecycle is about to begin. */ public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 11
Source File: MessageHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
/** * Handle a notification that the processing for a particular phase of the * request processing lifecycle is about to begin. */ public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 12
Source File: MessageHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
/** * Handle a notification that the processing for a particular phase of the * request processing lifecycle is about to begin. */ public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 13
Source File: BusinessLogicExceptionHandler.java From web-budget with GNU General Public License v3.0 | 5 votes |
/** * {@inheritDoc} * * @param context * @param exception */ @Override public void handle(FacesContext context, BusinessLogicException exception) { if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(exception); } final String i18nMessage = MessageSource.get(exception.getMessage()); FacesUtils.clearMessages(context); Messages.add(FacesMessage.SEVERITY_ERROR, null, i18nMessage, exception.getParameters()); context.renderResponse(); }
Example 14
Source File: MessageHandler.java From development with Apache License 2.0 | 5 votes |
/** * in RENDER_RESPONSE restore facesMessages */ public void beforePhase(PhaseEvent event) { if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 15
Source File: MessageHandler.java From spring4-sandbox with Apache License 2.0 | 5 votes |
/** * Handle a notification that the processing for a particular phase of the * request processing lifecycle is about to begin. */ public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) { FacesContext facesContext = event.getFacesContext(); restoreMessages(facesContext); } }
Example 16
Source File: BusinessLogicExceptionHandler.java From web-budget with GNU General Public License v3.0 | 5 votes |
/** * {@inheritDoc} * * @param context * @param exception */ @Override public void handle(FacesContext context, BusinessLogicException exception) { if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(exception); } final String i18nMessage = MessageSource.get(exception.getMessage()); FacesUtils.clearMessages(context); Messages.add(FacesMessage.SEVERITY_ERROR, null, i18nMessage, exception.getParameters()); context.renderResponse(); }
Example 17
Source File: SocialAuthPhaseListener.java From socialauth with MIT License | 4 votes |
public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; }
Example 18
Source File: LocaleListener.java From development with Apache License 2.0 | 4 votes |
public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; }
Example 19
Source File: CachePhaseListener.java From yawl with GNU Lesser General Public License v3.0 | 4 votes |
public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; }
Example 20
Source File: CachePhaseListener.java From yawl with GNU Lesser General Public License v3.0 | 4 votes |
public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; }