Package org.apache.wicket.request.mapper.parameter

Examples of org.apache.wicket.request.mapper.parameter.PageParameters


  }

  @Test
  public void testUndecorateUrl() throws Exception
  {
    ResourceUrl resourceUrl = new ResourceUrl("some-resource--vers--9A0364B9E99BB480DD25E1F0284C8555.txt", new PageParameters());
    strategy.undecorateUrl(resourceUrl);

    assertEquals("some-resource.txt", resourceUrl.getFileName());
  }
View Full Code Here


    WicketTester tester = new WicketTester();
    tester.getApplication().getResourceSettings().setCachingStrategy(strategy);

    try
    {
      ResourceUrl resourceUrl = new ResourceUrl("some-resource--vers--9A0364B9E99BB480DD25E1F0284C8555.txt", new PageParameters());
      strategy.undecorateUrl(resourceUrl);

      String version = tester.getRequestCycle().getMetaData(IResourceCachingStrategy.URL_VERSION);

      assertEquals("9A0364B9E99BB480DD25E1F0284C8555", version);
View Full Code Here

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();
    assertEquals(PAGE_CLASS_NAME, page.getClass().getName());

    PageParameters p = page.getPageParameters();
    assertEquals(1, p.getIndexedCount());
    assertEquals("indexed1", p.get(0).toString());

    assertEquals(2, p.getNamedKeys().size());
    assertEquals("b", p.get("a").toString());
    assertEquals("c", p.get("b").toString());
  }
View Full Code Here

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();
    checkPage(page, 15);

    PageParameters p = page.getPageParameters();
    assertEquals(0, p.getIndexedCount());

    assertEquals(0, p.getNamedKeys().size());
  }
View Full Code Here

    checkPage(page, 15);

    assertEquals(ILinkListener.INTERFACE, h.getListenerInterface());
    assertEquals("foo:bar", h.getComponent().getPageRelativePath());

    PageParameters p = page.getPageParameters();
    assertEquals(0, p.getIndexedCount());

    assertEquals(0, p.getNamedKeys().size());
  }
View Full Code Here

   *
   */
  @Test
  public void encode1()
  {
    PageProvider provider = new PageProvider(MockPage.class, new PageParameters());
    provider.setPageSource(context);
    IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);
    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME, url.toString());
  }
View Full Code Here

   *
   */
  @Test
  public void encode2()
  {
    PageParameters parameters = new PageParameters();
    parameters.set(0, "i1");
    parameters.set(1, "i2");
    parameters.set("a", "b");
    parameters.set("b", "c");
    PageProvider provider = new PageProvider(MockPage.class, parameters);
    provider.setPageSource(context);
    IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);
    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME + "/i1/i2?a=b&b=c", url.toString());
View Full Code Here

   *
   */
  @Test
  public void encode3()
  {
    PageParameters parameters = new PageParameters();
    parameters.set(0, "i1");
    parameters.set(1, "i2");
    parameters.set("a", "b");
    parameters.set("b", "c");

    PageProvider provider = new PageProvider(MockPage.class, parameters);
    provider.setPageSource(context);
    IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);
View Full Code Here

    public IRequestHandler onException(final RequestCycle cycle, final Exception e) {

        LOG.error("Exception found", e);

        final Page errorPage;
        PageParameters errorParameters = new PageParameters();
        errorParameters.add("errorTitle", new StringResourceModel("alert", null).getString());

        if (e instanceof UnauthorizedInstantiationException) {
            errorParameters.add("errorMessage", new StringResourceModel("unauthorizedInstantiationException", null)
                    .getString());

            errorPage = new ErrorPage(errorParameters);
        } else if (e instanceof HttpClientErrorException) {
            errorParameters.add("errorMessage", new StringResourceModel("httpClientException", null).getString());

            errorPage = new ErrorPage(errorParameters);
        } else if (e instanceof PageExpiredException || !(SyncopeSession.get()).isAuthenticated()) {

            errorParameters.add("errorMessage", new StringResourceModel("pageExpiredException", null).getString());

            errorPage = new ErrorPage(errorParameters);
        } else if (e.getCause() != null && e.getCause().getCause() != null
                && e.getCause().getCause() instanceof RestClientException) {

            errorParameters.add("errorMessage", new StringResourceModel("restClientException", null).getString());

            errorPage = new ErrorPage(errorParameters);
        } else {
            // redirect to default Wicket error page
            errorPage = new ExceptionErrorPage(e, null);
View Full Code Here

    else if (urlStartsWith(url, mountSegments))
    {
      // try to extract page and component information from URL
      PageComponentInfo info = getPageComponentInfo(url);
      Class<? extends IRequestablePage> pageClass = getPageClass();
      PageParameters pageParameters = extractPageParameters(request, url);

      return new UrlInfo(info, pageClass, pageParameters);
    }
    else
    {
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.mapper.parameter.PageParameters

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.