Package org.apache.wicket.request

Examples of org.apache.wicket.request.Url

The Url class takes care of encoding and decoding of the segments and parameters. @author Matej Knopp @author Igor Vaynberg

   * {@link org.apache.wicket.core.request.mapper.IMapperContext#getNamespace()}/{@link org.apache.wicket.core.request.mapper.IMapperContext#getPageIdentifier()}
   */
  @Test
  public void decode12()
  {
    final Url url = Url.parse(context.getBookmarkableIdentifier() + "/" + PAGE_CLASS_NAME);

    Request request = new Request()
    {
      @Override
      public Url getUrl()
      {
        return url;
      }

      @Override
      public Locale getLocale()
      {
        return null;
      }

      @Override
      public Charset getCharset()
      {
        return Charset.forName("UTF-8");
      }

      @Override
      public Url getClientUrl()
      {
        StringBuilder url = new StringBuilder();
        url.append(context.getNamespace())
            .append('/')
            .append(context.getPageIdentifier())
            .append("?3");
        return Url.parse(url.toString());
      }

      @Override
      public Object getContainerRequest()
      {
View Full Code Here


   * {@link org.apache.wicket.core.request.mapper.IMapperContext#getNamespace()}/{@link org.apache.wicket.core.request.mapper.IMapperContext#getPageIdentifier()}
   */
  @Test
  public void decode13()
  {
    final Url url = Url.parse(context.getBookmarkableIdentifier() + "/" + PAGE_CLASS_NAME);

    Request request = new Request()
    {
      @Override
      public Url getUrl()
      {
        return url;
      }

      @Override
      public Locale getLocale()
      {
        return null;
      }

      @Override
      public Charset getCharset()
      {
        return Charset.forName("UTF-8");
      }

      @Override
      public Url getClientUrl()
      {
        StringBuilder url = new StringBuilder();
        url.append(context.getBookmarkableIdentifier())
          .append('/')
          .append(PAGE_CLASS_NAME);
        return Url.parse(url.toString());
      }

      @Override
      public Object getContainerRequest()
      {
View Full Code Here

  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

    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

    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

    page.getPageParameters().set("b", "c");
    page.setCreatedBookmarkable(true);

    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);

    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME + "/i1/i2?15&a=b&b=c", url.toString());
  }
View Full Code Here

    page.setCreatedBookmarkable(false);

    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);

    // never allow bookmarkable render url for page that has not been created by bookmarkable
    // URL

    assertNull(url);
View Full Code Here

    PageAndComponentProvider provider = new PageAndComponentProvider(page, c);
    IRequestHandler handler = new BookmarkableListenerInterfaceRequestHandler(provider,
      ILinkListener.INTERFACE);

    Url url = encoder.mapHandler(handler);

    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME +
      "/i1/i2?15-0.ILinkListener-foo-bar&a=b&b=c", url.toString());
  }
View Full Code Here

    PageAndComponentProvider provider = new PageAndComponentProvider(page, c);
    IRequestHandler handler = new BookmarkableListenerInterfaceRequestHandler(provider,
      ILinkListener.INTERFACE, 4);

    Url url = encoder.mapHandler(handler);

    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME +
      "/i1/i2?15-0.ILinkListener.4-foo-bar&a=b&b=c", url.toString());
  }
View Full Code Here

    page.setPageStateless(true);

    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);

    Url url = encoder.mapHandler(handler);

    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME, url.toString());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.Url

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.