Ejemplo n.º 1
0
 /**
  * @throws ServletException
  * @see javax.servlet.http.HttpServlet#service(javax.servlet.ServletRequest,
  *     javax.servlet.ServletResponse)
  */
 @Override
 public void service(
     @SuppressWarnings("unused") final ServletRequest servletRequest,
     final ServletResponse servletResponse)
     throws ServletException {
   try {
     HttpServletResponse response = (HttpServletResponse) servletResponse;
     ServletOutputStream out = response.getOutputStream();
     out.write(result.getBytes());
   } catch (Throwable t) {
     Exception ve = new VersionException(t);
     ExceptionUtils.catchException(ve);
     throw new ServletException(ve);
   }
 }
 /**
  * @param context
  * @param ex
  * @throws IOException
  * @throws ServletException
  */
 public void handleException(final FacesContext context, final Exception ex) {
   // besoin d'exposer la requête pour y mettre dans la session le ExceptionService
   PortletRequest request = (PortletRequest) context.getExternalContext().getRequest();
   ContextUtils.exposeRequest(request);
   ExceptionUtils.markExceptionCaught();
   ExceptionService e = null;
   //		try {
   e = ExceptionUtils.catchException(ex);
   //		} catch (Throwable t) {
   //			handleExceptionHandlingException(t);
   //			// never reached, prevent from warnings
   //			return;
   //		}
   ExceptionUtils.markExceptionCaught(e);
   ContextUtils.unexposeRequest(request);
   NavigationHandler navigation = context.getApplication().getNavigationHandler();
   // Redirection vers la page des erreurs
   navigation.handleNavigation(context, "", e.getExceptionView());
 }