Examples of ErrorCodeRequestHandler


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

   *            {@link javax.servlet.http.HttpServletResponse} constants
   * @see javax.servlet.http.HttpServletResponse
   */
  public AbortWithHttpErrorCodeException(final int errorCode, final String message)
  {
    super(new ErrorCodeRequestHandler(errorCode, message));
    this.errorCode = errorCode;
    this.message = message;
  }
View Full Code Here

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

    DefaultExceptionMapper mapper = new DefaultExceptionMapper();
    PackageResource.PackageResourceBlockedException x =
        new PackageResource.PackageResourceBlockedException("test");
    IRequestHandler handler = mapper.map(x);
    assertThat(handler, instanceOf(ErrorCodeRequestHandler.class));
    ErrorCodeRequestHandler errorCodeRequestHandler = (ErrorCodeRequestHandler) handler;
    assertThat(errorCodeRequestHandler.getErrorCode(), is(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
  }
View Full Code Here

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

    DefaultExceptionMapper mapper = new DefaultExceptionMapper();
    PackageResource.PackageResourceBlockedException x =
        new PackageResource.PackageResourceBlockedException("test");
    IRequestHandler handler = mapper.map(x);
    assertThat(handler, instanceOf(ErrorCodeRequestHandler.class));
    ErrorCodeRequestHandler errorCodeRequestHandler = (ErrorCodeRequestHandler) handler;
    assertThat(errorCodeRequestHandler.getErrorCode(), is(HttpServletResponse.SC_NOT_FOUND));
  }
View Full Code Here

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

    DefaultExceptionMapper mapper = new DefaultExceptionMapper();
    PackageResource.PackageResourceBlockedException x =
        new PackageResource.PackageResourceBlockedException("test");
    IRequestHandler handler = mapper.map(x);
    assertThat(handler, instanceOf(ErrorCodeRequestHandler.class));
    ErrorCodeRequestHandler errorCodeRequestHandler = (ErrorCodeRequestHandler) handler;
    assertThat(errorCodeRequestHandler.getErrorCode(), is(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
  }
View Full Code Here

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

    DefaultExceptionMapper mapper = new DefaultExceptionMapper();
    PackageResource.PackageResourceBlockedException x =
        new PackageResource.PackageResourceBlockedException("test");
    IRequestHandler handler = mapper.map(x);
    assertThat(handler, instanceOf(ErrorCodeRequestHandler.class));
    ErrorCodeRequestHandler errorCodeRequestHandler = (ErrorCodeRequestHandler) handler;
    assertThat(errorCodeRequestHandler.getErrorCode(), is(HttpServletResponse.SC_NOT_FOUND));
  }
View Full Code Here

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

   *            the optional message to send to the client
   * @see javax.servlet.http.HttpServletResponse
   */
  public AbortWithHttpErrorCodeException(final int errorCode, final String message)
  {
    super(new ErrorCodeRequestHandler(errorCode, message));
    this.errorCode = errorCode;
    this.message = message;
  }
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 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 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

        if (log.isErrorEnabled())
        {
          log.error("key: " + PAGE_CLASS + " is null.");
        }
        getRequestCycle().replaceAllRequestHandlers(
          new ErrorCodeRequestHandler(404,
            "Could not find sources for the page you requested"));
      }
      else 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 = WicketObjects.resolveClass(pageParam);

      if (page == null)
      {
        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

        if (log.isErrorEnabled())
        {
          log.error("key: " + PAGE_CLASS + " is null.");
        }
        getRequestCycle().replaceAllRequestHandlers(
          new ErrorCodeRequestHandler(404,
            "Could not find sources for the page you requested"));
      }
      else 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 = WicketObjects.resolveClass(pageParam);

      if (page == null)
      {
        getRequestCycle().replaceAllRequestHandlers(
            new ErrorCodeRequestHandler(404,
                "Could not find sources for the page you requested"));
      }
    }
    return page;
  }
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.