Examples of PageParameters


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

    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

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

   *
   */
  @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

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

   *
   */
  @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

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

   *
   */
  @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

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

    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

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

    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

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

  {
    int[] matchedParameters = getMatchedSegmentSizes(url);
    int total = 0;
    for (int curMatchSize : matchedParameters)
      total += curMatchSize;
    PageParameters pageParameters = extractPageParameters(request, total, pageParametersEncoder);

    int skippedParameters = 0;
    for (int pathSegmentIndex = 0; pathSegmentIndex < pathSegments.size(); pathSegmentIndex++)
    {
      MountPathSegment curPathSegment = pathSegments.get(pathSegmentIndex);
      int matchSize = matchedParameters[pathSegmentIndex] - curPathSegment.getFixedPartSize();
      int optionalParameterMatch = matchSize - curPathSegment.getMinParameters();
      for (int matchSegment = 0; matchSegment < matchSize; matchSegment++)
      {
        if (pageParameters == null)
        {
          pageParameters = new PageParameters();
        }

        int curSegmentIndex = matchSegment + curPathSegment.getSegmentIndex();
        String curSegment = mountSegments[curSegmentIndex];
        String placeholder = getPlaceholder(curSegment);
        String optionalPlaceholder = getOptionalPlaceholder(curSegment);
        // extract the parameter from URL
        if (placeholder != null)
        {
          pageParameters.add(placeholder,
            url.getSegments().get(curSegmentIndex - skippedParameters));
        }
        else if (optionalPlaceholder != null && optionalParameterMatch > 0)
        {
          pageParameters.add(optionalPlaceholder,
            url.getSegments().get(curSegmentIndex - skippedParameters));
          optionalParameterMatch--;
        }
      }
      skippedParameters += curPathSegment.getMaxParameters() - matchSize;
View Full Code Here

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

    return ret;
  }

  protected PageParameters newPageParameters()
  {
    return new PageParameters();
  }
View Full Code Here

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

        PageInfo pageInfo = new PageInfo(page.getPageId());
        ComponentInfo componentInfo = new ComponentInfo(renderCount,
          requestListenerInterfaceToString(listenerInterface), componentPath,
          handler.getBehaviorIndex());
        PageComponentInfo pageComponentInfo = new PageComponentInfo(pageInfo, componentInfo);
        PageParameters parameters = new PageParameters(page.getPageParameters());
        UrlInfo urlInfo = new UrlInfo(pageComponentInfo, page.getClass(),
          parameters.mergeWith(handler.getPageParameters()));
        url = buildUrl(urlInfo);
      }
    }

    return url;
View Full Code Here

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

    {
      url.getSegments().add(s);
    }
    encodePageComponentInfo(url, info.getPageComponentInfo());

    PageParameters copy = new PageParameters(info.getPageParameters());

    int dropped = 0;
    for (int i = 0; i < mountSegments.length; ++i)
    {
      String placeholder = getPlaceholder(mountSegments[i]);
      String optionalPlaceholder = getOptionalPlaceholder(mountSegments[i]);
      if (placeholder != null)
      {
        url.getSegments().set(i - dropped, copy.get(placeholder).toString(""));
        copy.remove(placeholder);
      }
      else if (optionalPlaceholder != null)
      {
        if (copy.getNamedKeys().contains(optionalPlaceholder))
        {
          url.getSegments().set(i - dropped, copy.get(optionalPlaceholder).toString(""));
          copy.remove(optionalPlaceholder);
        }
        else
        {
          url.getSegments().remove(i - dropped);
          dropped++;
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.