Package org.apache.wicket.request.handler

Examples of org.apache.wicket.request.handler.RenderPageRequestHandler


    Integer renderCount)
  {
    PageProvider provider = new PageProvider(pageInfo.getPageId(), pageClass, pageParameters,
      renderCount);
    provider.setPageSource(getContext());
    return new RenderPageRequestHandler(provider);
  }
View Full Code Here


    else if (requestHandler instanceof RenderPageRequestHandler)
    {
      // possibly hybrid URL - bookmarkable URL with page instance information
      // but only allowed if the page was created by bookmarkable URL

      RenderPageRequestHandler handler = (RenderPageRequestHandler)requestHandler;

      if (!checkPageClass(handler.getPageClass()))
      {
        return null;
      }

      if (handler.getPageProvider().isNewPageInstance())
      {
        // no existing page instance available, don't bother creating new page instance
        PageInfo info = new PageInfo();
        UrlInfo urlInfo = new UrlInfo(new PageComponentInfo(info, null),
          handler.getPageClass(), handler.getPageParameters());

        return buildUrl(urlInfo);
      }

      IRequestablePage page = handler.getPage();

      if (!pageMustHaveBeenCreatedBookmarkable() || page.wasCreatedBookmarkable())
      {
        PageInfo info = null;
        if (!page.isPageStateless())
        {
          info = new PageInfo(page.getPageId());
        }
        PageComponentInfo pageComponentInfo = info != null ? new PageComponentInfo(info,
          null) : null;

        UrlInfo urlInfo = new UrlInfo(pageComponentInfo, page.getClass(),
          handler.getPageParameters());
        return buildUrl(urlInfo);
      }
      else
      {
        return null;
      }

    }
    else if (requestHandler instanceof BookmarkableListenerInterfaceRequestHandler)
    {
      // listener interface URL with page class information
      BookmarkableListenerInterfaceRequestHandler handler = (BookmarkableListenerInterfaceRequestHandler)requestHandler;
      Class<? extends IRequestablePage> pageClass = handler.getPageClass();

      if (!checkPageClass(pageClass))
      {
        return null;
      }

      Integer renderCount = null;
      if (handler.getListenerInterface().isIncludeRenderCount())
      {
        renderCount = handler.getRenderCount();
      }

      PageInfo pageInfo = new PageInfo(handler.getPageId());
      ComponentInfo componentInfo = new ComponentInfo(renderCount,
        requestListenerInterfaceToString(handler.getListenerInterface()),
        handler.getComponentPath(), handler.getBehaviorIndex());

      UrlInfo urlInfo = new UrlInfo(new PageComponentInfo(pageInfo, componentInfo),
        pageClass, handler.getPageParameters());
      return buildUrl(urlInfo);
    }

    return null;
  }
View Full Code Here

      {
        pageUrl = RequestCycle.get().urlFor(page.getClass(), page.getPageParameters());
      }
      else
      {
        IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
        pageUrl = RequestCycle.get().urlFor(handler);
      }
      appendAssignment(buffer, "settings.src", pageUrl);
    }
    else
View Full Code Here

    provider = mock(IPageProvider.class);

    page = mock(IRequestablePage.class);
    when(provider.getPageInstance()).thenReturn(page);

    handler = new RenderPageRequestHandler(provider);

    requestCycle = mock(RequestCycle.class);
    urlRenderer = mock(UrlRenderer.class);
    when(requestCycle.getUrlRenderer()).thenReturn(urlRenderer);
View Full Code Here

   *            the redirect policy to use
   */
  public RestartResponseException(final IPageProvider pageProvider,
    final RedirectPolicy redirectPolicy)
  {
    super(new RenderPageRequestHandler(pageProvider, redirectPolicy));
  }
View Full Code Here

    if (markupIdToComponent.values().contains(page))
    {
      // the page itself has been added to the request target, we simply issue a redirect
      // back to the page
      IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
      final String url = rc.urlFor(handler).toString();
      response.sendRedirect(url);
      return;
    }
View Full Code Here

    startComponent = null;

    // prepare request
    request = new MockHttpServletRequest(application, httpSession, servletContext);
    request.setURL(request.getContextPath() + request.getServletPath() + "/");
    IRequestHandler handler = new RenderPageRequestHandler(pageProvider);

    // process request
    processRequest(request, handler);

    // The page rendered
View Full Code Here

   * Tests that {@link CryptoMapper} wraps the original request mapper and encrypts the url
   * produced by it
   */
  public void testEncrypt()
  {
    Url url = mapper.mapHandler(new RenderPageRequestHandler(new PageProvider(
      DummyHomePage.class, new PageParameters())));
    assertEquals(ENCRYPTED_URL, url.toString());
  }
View Full Code Here

  {
    Request request = getRequest(Url.parse(ENCRYPTED_URL));
    IRequestHandler requestHandler = mapper.mapRequest(request);
    assertTrue(requestHandler instanceof RenderPageRequestHandler);

    RenderPageRequestHandler handler = (RenderPageRequestHandler)requestHandler;
    assertEquals(DummyHomePage.class, handler.getPageClass());
  }
View Full Code Here

    PageParameters expectedParameters = new PageParameters();
    expectedParameters.add("namedKey1", "namedValue1");
    expectedParameters.add("namedKey2", "namedValue2");
    expectedParameters.set(0, "indexedValue1");
    expectedParameters.set(1, "indexedValue2");
    RenderPageRequestHandler renderPageRequestHandler = new RenderPageRequestHandler(
      new PageProvider(DummyHomePage.class, expectedParameters));
    Url url = mapper.mapHandler(renderPageRequestHandler);
// System.err.println(url.toString());
    assertEquals(expectedEncrypted, url.toString());

    Request request = getRequest(url);
    IRequestHandler requestHandler = mapper.mapRequest(request);
    assertTrue(requestHandler instanceof RenderPageRequestHandler);

    RenderPageRequestHandler handler = (RenderPageRequestHandler)requestHandler;
    assertEquals(DummyHomePage.class, handler.getPageClass());
    PageParameters actualParameters = handler.getPageParameters();
    assertEquals(expectedParameters, actualParameters);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.handler.RenderPageRequestHandler

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.