Package org.apache.wicket

Examples of org.apache.wicket.PageParameters


    if (matches(requestTarget) == false)
    {
      throw new IllegalArgumentException("Unsupported request target type.");
    }

    PageParameters parameters = getPageParameters(requestTarget);
    PageInfo pageInfo = getPageInfo(requestTarget);

    final AppendingStringBuffer url = new AppendingStringBuffer(40);
    url.append(getMountPath());
View Full Code Here


    @Override
    protected <C extends Page> Page newPage(final Class<C> pageClass,
      final RequestCycle requestCycle)
    {
      Page page = super.newPage(pageClass, requestCycle);
      page.setMetaData(PAGE_PARAMETERS_META_DATA_KEY, new PageParameters(getPageParameters()));
      page.setMetaData(ORIGINAL_TRAILING_SLASHES_COUNT_METADATA_KEY, new Integer(
        originalUrlTrailingSlashesCount));
      return page;
    }
View Full Code Here

  }

  /** {@inheritDoc} */
  protected ValueMap decodeParameters(String urlFragment, Map urlParameters)
  {
    PageParameters params = new PageParameters();
    // Add all url parameters
    params.putAll(urlParameters);
    String urlPath = urlFragment;
    if (urlPath.startsWith("/"))
    {
      urlPath = urlPath.substring(1);
    }

    if (urlPath.length() > 0)
    {
      String[] pathParts = urlPath.split("/");
      if (pathParts.length > parameterNames.length)
      {
        throw new IllegalArgumentException(
          "Too many path parts, please provide sufficient number of path parameter names");
      }

      for (int i = 0; i < pathParts.length; i++)
      {
        params.put(parameterNames[i], urlDecodePathComponent(pathParts[i]));
      }
    }

    return params;
  }
View Full Code Here

    String pageMapName = pageInfo != null ? pageInfo.getPageMapName() : null;
    Integer pageVersion = pageInfo != null ? pageInfo.getVersionNumber() : null;
    Integer pageId = pageInfo != null ? pageInfo.getPageId() : null;

    // decode parameters
    PageParameters parameters = new PageParameters(decodeParameters(
      extraction.getUrlAfterExtraction(), requestParameters.getParameters()));

    if (requestParameters.getPageMapName() == null)
    {
      requestParameters.setPageMapName(pageMapName);
    }
    else
    {
      pageMapName = requestParameters.getPageMapName();
    }

    // do some extra work for checking whether this is a normal request to a
    // bookmarkable page, or a request to a stateless page (in which case a
    // wicket:interface parameter should be available
    final String interfaceParameter = (String)parameters.remove(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME);

    // we need to remember the amount of trailing slashes after the redirect
    // (otherwise we'll break relative urls)
    int originalUrlTrailingSlashesCount = getTrailingSlashesCount(extraction.getUrlAfterExtraction());
View Full Code Here

    if (matches(requestTarget) == false)
    {
      throw new IllegalArgumentException("Unsupported request target type.");
    }

    PageParameters parameters = getPageParameters(requestTarget);
    PageInfo pageInfo = getPageInfo(requestTarget);

    final AppendingStringBuffer url = new AppendingStringBuffer(40);
    url.append(getMountPath());
View Full Code Here

    {
      private static final long serialVersionUID = 1L;

      public Page getTestPage()
      {
        PageParameters params = new PageParameters();
        params.add("0", "param");
        return new MyPage();
      }
    });
  }
View Full Code Here

    }

    protected Page newPage(Class pageClass, RequestCycle requestCycle)
    {
      Page page = super.newPage(pageClass, requestCycle);
      page.setMetaData(PAGE_PARAMETERS_META_DATA_KEY, new PageParameters(getPageParameters()));
      page.setMetaData(ORIGINAL_TRAILING_SLASHES_COUNT_METADATA_KEY, new Integer(
        originalUrlTrailingSlashesCount));
      return page;
    }
View Full Code Here

   */
  public IRequestTarget decode(RequestParameters requestParameters)
  {
    final String parametersFragment = requestParameters.getPath().substring(
      getMountPath().length());
    final PageParameters parameters = new PageParameters(decodeParameters(parametersFragment,
      requestParameters.getParameters()));

    // do some extra work for checking whether this is a normal request to a
    // bookmarkable page, or a request to a stateless page (in which case a
    // wicket:interface parameter should be available

    // the page map name can be defined already by logic done in
    // WebRequestCodingStrategy.decode(),
    // but it could also be done by the decodeParameters() call
    // So we always remove the pagemap parameter just in case.
    String pageMapNameEncoded = (String)parameters.remove(WebRequestCodingStrategy.PAGEMAP);
    if (requestParameters.getPageMapName() == null)
    {
      requestParameters.setPageMapName(pageMapNameEncoded);
    }

    // the interface can be defined already by logic done in
    // WebRequestCodingStrategy.decode(),
    // but it could also be done by the decodeParameters() call
    // So we always remove the interface parameter just in case.
    String interfaceParameter = (String)parameters.remove(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME);
    if (requestParameters.getInterfaceName() == null)
    {
      WebRequestCodingStrategy.addInterfaceParameters(interfaceParameter, requestParameters);
    }

View Full Code Here

    }
    final AppendingStringBuffer url = new AppendingStringBuffer(40);
    url.append(getMountPath());
    final IBookmarkablePageRequestTarget target = (IBookmarkablePageRequestTarget)requestTarget;

    PageParameters pageParameters = target.getPageParameters();
    String pagemap = pageMapName != null ? pageMapName : target.getPageMapName();
    if (pagemap != null)
    {
      if (pageParameters == null)
      {
        pageParameters = new PageParameters();
      }
      pageParameters.put(WebRequestCodingStrategy.PAGEMAP,
        WebRequestCodingStrategy.encodePageMapName(pagemap));
    }
    appendParameters(url, pageParameters);
    return url;
  }
View Full Code Here

          Field parametersField = BookmarkablePageLink.class.getDeclaredField("parameters");
          Method getParametersMethod = BookmarkablePageLink.class.getDeclaredMethod(
            "getPageParameters", null);
          getParametersMethod.setAccessible(true);

          PageParameters parameters = (PageParameters)getParametersMethod.invoke(
            bookmarkablePageLink, null);
          setParametersForNextRequest(parameters);
        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of org.apache.wicket.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.