Package org.apache.wicket

Examples of org.apache.wicket.Application$DefaultPageManagerProvider


      if (pageClass != null && IRequestablePage.class.isAssignableFrom(pageClass))
      {
        if (Application.exists())
        {
          Application application = Application.get();

          if (application.getSecuritySettings().getEnforceMounts())
          {
            // we make an excepion if the homepage itself was mounted, see WICKET-1898
            if (!pageClass.equals(application.getHomePage()))
            {
              // WICKET-5094 only enforce mount if page is mounted
              Url reverseUrl = application.getRootRequestMapper().mapHandler(
                new RenderPageRequestHandler(new PageProvider(pageClass)));
              if (!matches(reverseUrl))
              {
                return null;
              }
View Full Code Here


  public static CharSequence renderPage(final PageProvider pageProvider)
  {
    final RenderPageRequestHandler handler = new RenderPageRequestHandler(pageProvider,
        RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT);

    Application application = Application.get();
    final PageRenderer pageRenderer = application.getPageRendererProvider().get(handler);

    RequestCycle originalRequestCycle = RequestCycle.get();

    BufferedWebResponse tempResponse = new BufferedWebResponse(null);

    RequestCycleContext requestCycleContext = new RequestCycleContext(originalRequestCycle.getRequest(),
        tempResponse, application.getRootRequestMapper(), application.getExceptionMapperProvider().get());
    RequestCycle tempRequestCycle = new RequestCycle(requestCycleContext);

    final Response oldResponse = originalRequestCycle.getResponse();

    try
View Full Code Here

    for (ITargetRespondListener listener : respondListeners)
    {
      listener.onTargetRespond(this);
    }

    final Application app = page.getApplication();

    page.send(app, Broadcast.BREADTH, this);

    // Determine encoding
    final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();

    // Set content type based on markup type for page
    responseObject.setContentType(response, encoding);

    // Make sure it is not cached by a client
View Full Code Here

      if (pageClass != null && IRequestablePage.class.isAssignableFrom(pageClass))
      {
        if (Application.exists())
        {
          Application application = Application.get();

          if (application.getSecuritySettings().getEnforceMounts())
          {
            // we make an exception if the homepage itself was mounted, see WICKET-1898
            if (!pageClass.equals(application.getHomePage()))
            {
              // WICKET-5094 only enforce mount if page is mounted
              Url reverseUrl = application.getRootRequestMapper().mapHandler(
                new RenderPageRequestHandler(new PageProvider(pageClass)));
              if (!matches(request.cloneWithUrl(reverseUrl)))
              {
                return null;
              }
View Full Code Here

   *
   * @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
   */
  public void respond(RequestCycle requestCycle)
  {
    Application application = requestCycle.getApplication();
    SharedResources sharedResources = application.getSharedResources();
    final String resourceKey = getRequestParameters().getResourceKey();
    Resource resource = sharedResources.get(resourceKey);

    // try to lazily register
    if (resource == null)
    {
      int ix = resourceKey.indexOf('/');
      if (ix != -1)
      {
        String className = resourceKey.substring(0, ix);
        IClassResolver resolver = application.getApplicationSettings().getClassResolver();
        Class scope = null;
        try
        {
          // First try to match mounted resources.
          scope = Application.get().getSharedResources().getAliasClass(className);

          // If that fails, resolve it as a fully qualified class
          // name.
          if (scope == null)
          {
            scope = resolver.resolveClass(className);
          }
          final CharSequence escapeString = application.getResourceSettings()
            .getParentFolderPlaceholder();
          // get path component of resource key, replace' ..' with escape sequence to
          // prevent crippled urls in browser
          String path = resourceKey.substring(ix + 1);
          path = Strings.replaceAll(path, escapeString, "..").toString();
View Full Code Here

  {
    super(contentType);

    String path = Packages.absolutePath(clazz, fileName);

    Application app = Application.get();
    TextTemplateCache cache = (TextTemplateCache)app.getMetaData(TEXT_TEMPLATE_CACHE_KEY);
    // TODO implement cache

    // first try default class loading locator to find the resource
    IResourceStream stream = new ResourceStreamLocator().locate(clazz, path);
View Full Code Here

      for (ITargetRespondListener listener : respondListeners)
      {
        listener.onTargetRespond(this);
      }

      final Application app = Application.get();

      // Determine encoding
      final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();

      // Set content type based on markup type for page
      response.setContentType("text/xml; charset=" + encoding);

      // Make sure it is not cached by a client
View Full Code Here

   * Covariant override for easy getting the current {@link WebApplication} without having to cast
   * it.
   */
  public static WebApplication get()
  {
    Application application = Application.get();

    if (application instanceof WebApplication == false)
    {
      throw new WicketRuntimeException(
        "The application attached to the current thread is not a " +
View Full Code Here

   *      org.apache.wicket.RequestCycle)
   */
  public void respond(RuntimeException e, RequestCycle requestCycle)
  {
    // If application doesn't want debug info showing up for users
    final Application application = Application.get();
    final IExceptionSettings settings = application.getExceptionSettings();
    final Page responsePage = requestCycle.getResponsePage();

    Page override = onRuntimeException(responsePage, e);
    if (override != null)
    {
      throw new RestartResponseException(override);
    }
    else if (e instanceof AuthorizationException)
    {
      // are authorization exceptions always thrown before the real
      // render?
      // else we need to make a page (see below) or set it hard to a
      // redirect.
      Class accessDeniedPageClass = application.getApplicationSettings()
        .getAccessDeniedPage();

      throw new RestartResponseAtInterceptPageException(accessDeniedPageClass);
    }
    else if (e instanceof PageExpiredException)
    {
      Class pageExpiredErrorPageClass = application.getApplicationSettings()
        .getPageExpiredErrorPage();
      boolean mounted = isPageMounted(pageExpiredErrorPageClass);
      RequestCycle.get().setRedirect(mounted);
      throw new RestartResponseException(pageExpiredErrorPageClass);
    }
    else if (settings.getUnexpectedExceptionDisplay() != IExceptionSettings.SHOW_NO_EXCEPTION_PAGE)
    {
      // we do not want to redirect - we want to inline the error output
      // and preserve the url so when the refresh button is pressed we
      // rerun the code that caused the error
      requestCycle.setRedirect(false);

      // figure out which error page to show
      Class internalErrorPageClass = application.getApplicationSettings()
        .getInternalErrorPage();
      Class responseClass = responsePage != null ? responsePage.getClass() : null;

      if (responseClass != internalErrorPageClass &&
        settings.getUnexpectedExceptionDisplay() == IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
View Full Code Here

   */
  protected IRequestTarget resolveHomePageTarget(final RequestCycle requestCycle,
    final RequestParameters requestParameters)
  {
    Session session = requestCycle.getSession();
    Application application = session.getApplication();
    try
    {
      // Get the home page class
      Class homePageClass = application.getHomePage();

      PageParameters parameters = new PageParameters(requestParameters.getParameters());
      // and create a dummy target for looking up whether the home page is
      // mounted
      BookmarkablePageRequestTarget homepageTarget = new BookmarkablePageRequestTarget(
View Full Code Here

TOP

Related Classes of org.apache.wicket.Application$DefaultPageManagerProvider

Copyright © 2018 www.massapicom. 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.