Examples of ErrorCodeRequestHandler


Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

      }

      // hmmm, we were already handling an exception! give up
      logger.error("unexpected exception when handling another exception: " + e.getMessage(),
        e);
      return new ErrorCodeRequestHandler(500);
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

    if (isProcessingAjaxRequest())
    {
      switch (application.getExceptionSettings().getAjaxErrorHandlingStrategy())
      {
        case INVOKE_FAILURE_HANDLER :
          return new ErrorCodeRequestHandler(500);
      }
    }

    if (e instanceof StalePageException)
    {
      // If the page was stale, just rerender it
      // (the url should always be updated by an redirect in that case)
      return new RenderPageRequestHandler(new PageProvider(((StalePageException)e).getPage()));
    }
    else if (e instanceof PageExpiredException)
    {
      return createPageRequestHandler(new PageProvider(Application.get()
        .getApplicationSettings()
        .getPageExpiredErrorPage()));
    }
    else if (e instanceof AuthorizationException ||
      e instanceof ListenerInvocationNotAllowedException)
    {
      return createPageRequestHandler(new PageProvider(Application.get()
        .getApplicationSettings()
        .getAccessDeniedPage()));
    }
    else if (e instanceof ResponseIOException)
    {
      logger.error("Connection lost, give up responding.", e);
      return new EmptyRequestHandler();
    }
    else
    {

      final UnexpectedExceptionDisplay unexpectedExceptionDisplay = application.getExceptionSettings()
        .getUnexpectedExceptionDisplay();

      logger.error("Unexpected error occurred", e);

      if (IExceptionSettings.SHOW_EXCEPTION_PAGE.equals(unexpectedExceptionDisplay))
      {
        Page currentPage = extractCurrentPage();
        return createPageRequestHandler(new PageProvider(new ExceptionErrorPage(e,
          currentPage)));
      }
      else if (IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE.equals(unexpectedExceptionDisplay))
      {
        return createPageRequestHandler(new PageProvider(
          application.getApplicationSettings().getInternalErrorPage()));
      }
      else
      {
        // IExceptionSettings.SHOW_NO_EXCEPTION_PAGE
        return new ErrorCodeRequestHandler(500);
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

      }

      // hmmm, we were already handling an exception! give up
      logger.error("unexpected exception when handling another exception: " + e.getMessage(),
        e);
      return new ErrorCodeRequestHandler(500);
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

    if (isProcessingAjaxRequest())
    {
      switch (application.getExceptionSettings().getAjaxErrorHandlingStrategy())
      {
        case INVOKE_FAILURE_HANDLER :
          return new ErrorCodeRequestHandler(500);
      }
    }

    if (e instanceof StalePageException)
    {
      // If the page was stale, just re-render it
      // (the url should always be updated by an redirect in that case)
      return new RenderPageRequestHandler(new PageProvider(((StalePageException)e).getPage()));
    }
    else if (e instanceof PageExpiredException)
    {
      return createPageRequestHandler(new PageProvider(Application.get()
        .getApplicationSettings()
        .getPageExpiredErrorPage()));
    }
    else if (e instanceof AuthorizationException ||
      e instanceof ListenerInvocationNotAllowedException)
    {
      return createPageRequestHandler(new PageProvider(Application.get()
        .getApplicationSettings()
        .getAccessDeniedPage()));
    }
    else if (e instanceof ResponseIOException)
    {
      logger.error("Connection lost, give up responding.", e);
      return new EmptyRequestHandler();
    }
    else if (e instanceof PackageResource.PackageResourceBlockedException && application.usesDeploymentConfig())
    {
      logger.debug(e.getMessage(), e);
      return new ErrorCodeRequestHandler(404);
    }
    else
    {

      final ExceptionSettings.UnexpectedExceptionDisplay unexpectedExceptionDisplay = application.getExceptionSettings()
        .getUnexpectedExceptionDisplay();

      logger.error("Unexpected error occurred", e);

      if (ExceptionSettings.SHOW_EXCEPTION_PAGE.equals(unexpectedExceptionDisplay))
      {
        Page currentPage = extractCurrentPage();
        return createPageRequestHandler(new PageProvider(new ExceptionErrorPage(e,
          currentPage)));
      }
      else if (ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE.equals(unexpectedExceptionDisplay))
      {
        return createPageRequestHandler(new PageProvider(
          application.getApplicationSettings().getInternalErrorPage()));
      }
      else
      {
        // IExceptionSettings.SHOW_NO_EXCEPTION_PAGE
        return new ErrorCodeRequestHandler(500);
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

  public void onUnauthorizedRequest(IResource resource, PageParameters parameters)
  {
    RequestCycle cycle = RequestCycle.get();
    if (cycle != null)
    {
      IRequestHandler handler = new ErrorCodeRequestHandler(HttpServletResponse.SC_FORBIDDEN, createErrorMessage(resource, parameters));
      cycle.replaceAllRequestHandlers(handler);
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

          if (log.isErrorEnabled())
          {
            log.error("key: " + PAGE_CLASS + " is null.");
          }
          getRequestCycle().replaceAllRequestHandlers(
            new ErrorCodeRequestHandler(404,
              "Could not find sources for the page you requested"));
        }
        if (!pageParam.startsWith("org.apache.wicket.examples"))
        {
          if (log.isErrorEnabled())
          {
            log.error("user is trying to access class: " + pageParam +
              " which is not in the scope of org.apache.wicket.examples");
          }
          throw new UnauthorizedInstantiationException(getClass());
        }
        page = (Class<? extends Page>)Class.forName(getPageParam());
      }
      catch (ClassNotFoundException e)
      {
        getRequestCycle().replaceAllRequestHandlers(
          new ErrorCodeRequestHandler(404,
            "Could not find sources for the page you requested"));
      }
    }
    return page;
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

      }

      // hmmm, we were already handling an exception! give up
      logger.error("unexpected exception when handling another exception: " + e.getMessage(),
        e);
      return new ErrorCodeRequestHandler(500);
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

    if (isProcessingAjaxRequest())
    {
      switch (application.getExceptionSettings().getAjaxErrorHandlingStrategy())
      {
        case INVOKE_FAILURE_HANDLER :
          return new ErrorCodeRequestHandler(500);
      }
    }

    if (e instanceof StalePageException)
    {
      // If the page was stale, just re-render it
      // (the url should always be updated by an redirect in that case)
      return new RenderPageRequestHandler(new PageProvider(((StalePageException)e).getPage()));
    }
    else if (e instanceof PageExpiredException)
    {
      return createPageRequestHandler(new PageProvider(Application.get()
        .getApplicationSettings()
        .getPageExpiredErrorPage()));
    }
    else if (e instanceof AuthorizationException ||
      e instanceof ListenerInvocationNotAllowedException)
    {
      return createPageRequestHandler(new PageProvider(Application.get()
        .getApplicationSettings()
        .getAccessDeniedPage()));
    }
    else if (e instanceof ResponseIOException)
    {
      logger.error("Connection lost, give up responding.", e);
      return new EmptyRequestHandler();
    }
    else if (e instanceof PackageResource.PackageResourceBlockedException && application.usesDeploymentConfig())
    {
      logger.debug(e.getMessage(), e);
      return new ErrorCodeRequestHandler(404);
    }
    else
    {

      final UnexpectedExceptionDisplay unexpectedExceptionDisplay = application.getExceptionSettings()
        .getUnexpectedExceptionDisplay();

      logger.error("Unexpected error occurred", e);

      if (IExceptionSettings.SHOW_EXCEPTION_PAGE.equals(unexpectedExceptionDisplay))
      {
        Page currentPage = extractCurrentPage();
        return createPageRequestHandler(new PageProvider(new ExceptionErrorPage(e,
          currentPage)));
      }
      else if (IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE.equals(unexpectedExceptionDisplay))
      {
        return createPageRequestHandler(new PageProvider(
          application.getApplicationSettings().getInternalErrorPage()));
      }
      else
      {
        // IExceptionSettings.SHOW_NO_EXCEPTION_PAGE
        return new ErrorCodeRequestHandler(500);
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

    catch (RuntimeException e2)
    {
      // hmmm, we were already handling an exception! give up
      logger.error("unexpected exception when handling another exception: " + e.getMessage(),
        e);
      return new ErrorCodeRequestHandler(500);
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.http.handler.ErrorCodeRequestHandler

    if (isProcessingAjaxRequest())
    {
      switch (application.getExceptionSettings().getAjaxErrorHandlingStrategy())
      {
        case INVOKE_FAILURE_HANDLER :
          return new ErrorCodeRequestHandler(500);
      }
    }

    if (e instanceof StalePageException)
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.