javax.faces.application.ViewExpiredException Java Examples
The following examples show how to use
javax.faces.application.ViewExpiredException.
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: AuthorizationFilterTest.java From development with Apache License 2.0 | 6 votes |
@Test public void doFilter_SessionTimeoutPublicAccess() throws Exception { // given ServletException se = new ServletException(new ViewExpiredException()); doThrow(se).when(authFilter).handleProtectedUrlAndChangePwdCase( eq(chainMock), any(HttpServletRequest.class), eq(responseMock), eq(authReqDataMock)); doNothing().when(authFilter).reLogginUserIfRequired( any(HttpServletRequest.class), eq(responseMock), eq(authReqDataMock), any(StringBuffer.class)); // when authFilter.doFilter(requestMock, responseMock, chainMock); // then verify(authFilter, times(1)).reLogginUserIfRequired( any(HttpServletRequest.class), eq(responseMock), eq(authReqDataMock), any(StringBuffer.class)); verify(responseMock, times(1)).sendRedirect(anyString()); }
Example #2
Source File: AuthorizationFilterTest.java From development with Apache License 2.0 | 6 votes |
@Test public void doFilter_SessionTimeoutRelogin() throws Exception { // given ServletException se = new ServletException(new ViewExpiredException()); doThrow(se).when(authFilter).handleProtectedUrlAndChangePwdCase( eq(chainMock), any(HttpServletRequest.class), eq(responseMock), eq(authReqDataMock)); doNothing().when(authFilter).reLogginUserIfRequired( any(HttpServletRequest.class), eq(responseMock), eq(authReqDataMock), any(StringBuffer.class)); doReturn("admin").when(requestMock).getParameter( eq(AuthorizationFilter.PARAM_LOGIN_USER_ID)); // when authFilter.doFilter(requestMock, responseMock, chainMock); // then verify(authFilter, times(1)).reLogginUserIfRequired( any(HttpServletRequest.class), eq(responseMock), eq(authReqDataMock), any(StringBuffer.class)); verify(responseMock, times(1)).sendRedirect(anyString()); }
Example #3
Source File: ViewExpiredExceptionExceptionHandler.java From journaldev with MIT License | 6 votes |
@Override public void handle() throws FacesException { for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) { ExceptionQueuedEvent event = i.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); if (t instanceof ViewExpiredException) { ViewExpiredException vee = (ViewExpiredException) t; FacesContext facesContext = FacesContext.getCurrentInstance(); Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap(); NavigationHandler navigationHandler = facesContext.getApplication().getNavigationHandler(); try { // Push some useful stuff to the request scope for use in the page requestMap.put("currentViewId", vee.getViewId()); navigationHandler.handleNavigation(facesContext, null, "/viewExpired"); facesContext.renderResponse(); } finally { i.remove(); } } } // At this point, the queue will not contain any ViewExpiredEvents. Therefore, let the parent handle them. getWrapped().handle(); }
Example #4
Source File: AdminfacesAutoConfiguration.java From joinfaces with Apache License 2.0 | 6 votes |
/** * This {@link WebFragmentRegistrationBean} is equivalent to the * {@code META-INF/web-fragment.xml} of the {@code admin-template.jar}. * * @return adminTemplateWebFragmentRegistrationBean */ @Bean public WebFragmentRegistrationBean adminTemplateWebFragmentRegistrationBean() { WebFragmentRegistrationBean bean = new WebFragmentRegistrationBean(); bean.getContextParams().put("primefaces.THEME", "admin"); bean.getErrorPages().add(new ErrorPage(HttpStatus.FORBIDDEN, "/403.xhtml")); bean.getErrorPages().add(new ErrorPage(AccessDeniedException.class, "/403.xhtml")); bean.getErrorPages().add(new ErrorPage(AccessLocalException.class, "/403.xhtml")); bean.getErrorPages().add(new ErrorPage(HttpStatus.NOT_FOUND, "/404.xhtml")); bean.getErrorPages().add(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.xhtml")); bean.getErrorPages().add(new ErrorPage(Throwable.class, "/500.xhtml")); bean.getErrorPages().add(new ErrorPage(ViewExpiredException.class, "/expired.xhtml")); bean.getErrorPages().add(new ErrorPage(OptimisticLockException.class, "/optimistic.xhtml")); bean.getListeners().add(AdminServletContextListener.class); return bean; }
Example #5
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #6
Source File: DefaultExceptionHandler.java From javaee8-jsf-sample with GNU General Public License v3.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); //t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof TaskNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #7
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #8
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #9
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #10
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #11
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #12
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #13
Source File: AuthorizationFilter.java From development with Apache License 2.0 | 5 votes |
/** * Check if the current URL is protected and the current session doesn't * contain a user object. If this is the case perform a login. * * The doFilter method of the Filter is called by the container each time a * request/response pair is passed through the chain due to a client request * for a resource at the end of the chain. * * @throws IOException * @throws ServletException * */ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = new IgnoreCharacterEncodingHttpRequestWrapper( (HttpServletRequest) request); HttpServletResponse httpResponse = (HttpServletResponse) response; AuthorizationRequestData rdo = initializeRequestDataObject(httpRequest); try { if (isPublicAccess(rdo, httpRequest)) { proceedWithFilterChain(chain, httpRequest, httpResponse); } else { handleProtectedUrlAndChangePwdCase(chain, httpRequest, httpResponse, rdo); } } catch (ServletException e) { // relogin is not possible in this case, // no SAML response to extract userid and generate password. if (authSettings.isServiceProvider()) { throw e; } if (e.getCause() instanceof ViewExpiredException) { // if we were logged in but a logout occurs from a different // browser tab, we get this exception - so redirect to the // same page to stay on it (Bug 7552) final StringBuffer url = new StringBuffer( rdo.getRelativePath() == null ? "" : rdo.getRelativePath()); reLogginUserIfRequired(httpRequest, httpResponse, rdo, url); sendRedirect(httpRequest, httpResponse, url.toString()); } else { throw e; } } }
Example #14
Source File: DefaultExceptionHandler.java From ee7-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { log.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); log.log(Level.INFO, "Exception@" + t); log.log(Level.INFO, "ExceptionHandlder began."); log.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } if (t instanceof FacesFileNotFoundException || t instanceof TaskNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } log.log(Level.INFO, "ExceptionHandlder end."); getWrapped().handle(); } }
Example #15
Source File: DefaultExceptionHandler.java From ee7-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { log.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); log.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #16
Source File: DefaultExceptionHandler.java From spring4-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { log.debug("invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); log.debug("Exception@" + t); log.debug("ExceptionHandlder began."); log.debug("t instanceof FacesException@" + (t instanceof FacesException)); log.debug("t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } if (t instanceof FacesFileNotFoundException|| t instanceof TaskNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } log.debug("ExceptionHandlder end."); getWrapped().handle(); } }
Example #17
Source File: DefaultExceptionHandler.java From spring4-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { log.debug(" handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); log.debug("view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #18
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #19
Source File: CustomExceptionHandler.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { final Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); while (i.hasNext()) { ExceptionQueuedEvent event = i.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); // get the exception from context Throwable t = context.getException(); FacesContext facesContext = FacesContext.getCurrentInstance(); if (t instanceof ViewExpiredException) { try { String homeLocation = "/index.xhtml"; facesContext.setViewRoot(facesContext.getApplication().getViewHandler().createView(facesContext, homeLocation)); facesContext.getPartialViewContext().setRenderAll(true); String messageText = "Your session is expired and data is resetted."; FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageText, messageText); facesContext.addMessage(null, message); facesContext.renderResponse(); } finally { //remove it from queue i.remove(); } } } //parent handle getWrapped().handle(); }
Example #20
Source File: DefaultExceptionHandler.java From javaee8-jsf-sample with GNU General Public License v3.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #21
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #22
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #23
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #24
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #25
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #26
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #27
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #28
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }
Example #29
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
@Override public void handle() throws FacesException { LOG.log(Level.INFO, "invoking custom ExceptionHandlder..."); Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator(); while (events.hasNext()) { ExceptionQueuedEvent event = events.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); LOG.log(Level.INFO, "Exception@" + t.getClass().getName()); LOG.log(Level.INFO, "ExceptionHandlder began."); LOG.log(Level.INFO, "t instanceof FacesException@" + (t instanceof FacesException)); // log.log(Level.INFO, "t instanceof FacesFileNotFoundException@" + (t instanceof FacesFileNotFoundException)); t.printStackTrace(); if (t instanceof ViewExpiredException) { try { handleViewExpiredException((ViewExpiredException) t); } finally { events.remove(); } } else if (t instanceof FacesFileNotFoundException) { try { handleNotFoundException((Exception) t); } finally { events.remove(); } } else { getWrapped().handle(); } LOG.log(Level.INFO, "ExceptionHandlder end."); } }
Example #30
Source File: DefaultExceptionHandler.java From ee8-sandbox with Apache License 2.0 | 5 votes |
private void handleViewExpiredException(ViewExpiredException vee) { LOG.log(Level.INFO, " handling viewExpiredException..."); FacesContext context = FacesContext.getCurrentInstance(); String viewId = vee.getViewId(); LOG.log(Level.INFO, "view id @" + viewId); NavigationHandler nav = context.getApplication().getNavigationHandler(); nav.handleNavigation(context, null, viewId); context.renderResponse(); }