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

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


   *            optional argument
   */
  public PageProvider(final Integer pageId, final Class<? extends IRequestablePage> pageClass,
    Integer renderCount)
  {
    this(pageId, pageClass, new PageParameters(), renderCount);
  }
View Full Code Here


    if (page == null)
    {
      if (pageClass != null)
      {
        PageParameters parameters;
        if (pageId != null)
        {
          // WICKET-4594 - re-creating an expired page. Ignore the parsed parameters for the callback url
          parameters = new PageParameters();
        }
        else
        {
          parameters = pageParameters;
        }
View Full Code Here

    // check if the URL is long enough and starts with the proper segments
    if (urlInfo != null)
    {
      PageComponentInfo info = urlInfo.getPageComponentInfo();
      Class<? extends IRequestablePage> pageClass = urlInfo.getPageClass();
      PageParameters pageParameters = urlInfo.getPageParameters();

      if (info == null)
      {
        // if there are is no page instance information (only page map name - optionally)
        // then this is a simple bookmarkable URL
View Full Code Here

     *            the current request's non-modified parameters
     * @return all parameters but Wicket internal ones
     */
    private PageParameters cleanPageParameters(final PageParameters originalParameters)
    {
      PageParameters cleanParameters = null;
      if (originalParameters != null)
      {
        cleanParameters = new PageParameters(originalParameters);

        // WICKET-4038: Ajax related parameters are set by wicket-ajax.js when needed.
        // They shouldn't be propagated to the next requests
        cleanParameters.remove(WebRequest.PARAM_AJAX);
        cleanParameters.remove(WebRequest.PARAM_AJAX_BASE_URL);
        cleanParameters.remove(WebRequest.PARAM_AJAX_REQUEST_ANTI_CACHE);

        if (cleanParameters.isEmpty())
        {
          cleanParameters = null;
        }
      }
      return cleanParameters;
View Full Code Here

    if (canBeHandled(url))
    {
      final int segmentsSize = url.getSegments().size();

      // extract the PageParameters from URL if there are any
      PageParameters pageParameters = extractPageParameters(request, segmentsSize,
          pageParametersEncoder);

      String className = url.getSegments().get(2);
      StringBuilder name = new StringBuilder(segmentsSize * 2);

 
View Full Code Here

      segments.add(getContext().getNamespace());
      segments.add(getContext().getResourceIdentifier());
      segments.add(getClassName(reference.getScope()));

      // setup resource parameters
      PageParameters parameters = referenceRequestHandler.getPageParameters();

      if (parameters == null)
      {
        parameters = new PageParameters();
      }
      else
      {
        parameters = new PageParameters(parameters);

        // need to remove indexed parameters otherwise the URL won't be able to decode
        parameters.clearIndexed();
      }
      encodeResourceReferenceAttributes(url, reference);

      StringTokenizer tokens = new StringTokenizer(reference.getName(), "/");

      while (tokens.hasMoreTokens())
      {
        String token = tokens.nextToken();

        // on the last component of the resource path
        if (tokens.hasMoreTokens() == false && Strings.isEmpty(token) == false)
        {
          final IResource resource = reference.getResource();

          // is resource supposed to be cached?
          if (resource instanceof IStaticCacheableResource)
          {
            final IStaticCacheableResource cacheable = (IStaticCacheableResource)resource;
           
            // is caching enabled?
            if(cacheable.isCachingEnabled())
            {
              // apply caching scheme to resource url
              final ResourceUrl resourceUrl = new ResourceUrl(token, parameters);
              getCachingStrategy().decorateUrl(resourceUrl, cacheable);
              token = resourceUrl.getFileName();
 
              Checks.notEmpty(token, "Caching strategy returned empty name for '%s'", resource);
            }
          }
        }
        segments.add(token);
      }

      if (parameters.isEmpty() == false)
      {
        url = encodePageParameters(url, parameters, pageParametersEncoder);
      }

      return url;
View Full Code Here

      new QueryStringWithVersionResourceCachingStrategy(versionParameter, resourceVersion);

  @Test
  public void testDecorateUrl() throws Exception
  {
    ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", new PageParameters());
    strategy.decorateUrl(resourceUrl, new TestResource());

    assertEquals("some-resource.txt", resourceUrl.getFileName());
    assertEquals("9A0364B9E99BB480DD25E1F0284C8555", resourceUrl.getParameters().get(versionParameter).toString());
  }
View Full Code Here

  }

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

    assertEquals("some-resource.txt", resourceUrl.getFileName());
    assertNull(resourceUrl.getParameters().get(versionParameter).toString());
View Full Code Here

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

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

      String version = tester.getRequestCycle().getMetaData(IResourceCachingStrategy.URL_VERSION);
View Full Code Here

      new FilenameWithVersionResourceCachingStrategy(versionPrefix, resourceVersion);

  @Test
  public void testDecorateUrl() throws Exception
  {
    ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", new PageParameters());
    strategy.decorateUrl(resourceUrl, new TestResource());

    assertEquals("some-resource--vers--9A0364B9E99BB480DD25E1F0284C8555.txt", resourceUrl.getFileName());
  }
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.