Package org.apache.wicket

Examples of org.apache.wicket.PageParameters


      encoder.addValue(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME,
        pageMapName + Component.PATH_SEPARATOR + pageClass.getName());
    }

    // Get page parameters
    final PageParameters parameters = requestTarget.getPageParameters();
    if (parameters != null)
    {
      final Iterator<String> iterator = parameters.keySet().iterator();
      while (iterator.hasNext())
      {
        final String key = iterator.next();
        final String values[] = parameters.getStringArray(key);
        if (values != null)
        {
          for (int i = 0; i < values.length; i++)
          {
            encoder.addValue(key, values[i]);
View Full Code Here


  /**
   * @throws Exception
   */
  public void testRenderHomePage4() throws Exception
  {
    executeTest(EnclosurePage_4.class, new PageParameters("visible=false"),
      "EnclosurePageExpectedResult_4.html");
  }
View Full Code Here

  /**
   * @throws Exception
   */
  public void testRenderHomePage4_1() throws Exception
  {
    executeTest(EnclosurePage_4.class, new PageParameters("visible=true"),
      "EnclosurePageExpectedResult_4-1.html");
  }
View Full Code Here

  /**
   * @throws Exception
   */
  public void testRenderHomePage5() throws Exception
  {
    executeTest(EnclosurePage_5.class, new PageParameters("visible=false"),
      "EnclosurePageExpectedResult_5.html");
  }
View Full Code Here

  /**
   * @throws Exception
   */
  public void testRenderHomePage5_1() throws Exception
  {
    executeTest(EnclosurePage_5.class, new PageParameters("visible=true"),
      "EnclosurePageExpectedResult_5-1.html");
  }
View Full Code Here

   *
   */
  public void testRequestWithIndexedParamsAndQueryString()
  {
    final WebRequestCycle cycle = tester.setupRequestAndResponse();
    final PageParameters params = new PageParameters();

    params.add("0", "param0");
    params.add("1", "param1");
    params.put("test", new String[] { "testval1", "testval2" });
    params.add("foo", "fooval");
    final String url = cycle.urlFor(new ResourceReference(RESOURCE_NAME), params).toString();
    assertEquals("test/param0/param1?test=testval1&test=testval2&foo=fooval", url);
    tester.getServletRequest().setURL(URL_PREFIX + url);
    tester.processRequestCycle(cycle);
    assertEquals(4, resource.params.size());
View Full Code Here

          BookmarkablePageLink.class.getDeclaredField("parameters");
          Method getParametersMethod = BookmarkablePageLink.class.getDeclaredMethod(
            "getPageParameters", (Class<?>[])null);
          getParametersMethod.setAccessible(true);

          PageParameters parameters = (PageParameters)getParametersMethod.invoke(
            bookmarkablePageLink, (Object[])null);
          setParametersForNextRequest(parameters.toRequestParameters());
        }
        catch (Exception e)
        {
          fail("Internal error in WicketTester. "
            + "Please report this in Wickets Issue Tracker.");
View Full Code Here

    }

    // WICKET-1912
    // If the form is stateless page parameters contain all form component
    // values. We need to remove those otherwise they get appended to action URL
    final PageParameters parameters = page.getPageParameters();
    if (parameters != null)
    {
      visitFormComponents(new FormComponent.IVisitor()
      {
        public Object formComponent(IFormVisitorParticipant formComponent)
        {
          if (formComponent instanceof FormComponent)
          {
            parameters.remove(((FormComponent<?>)formComponent).getInputName());
          }

          return Component.IVisitor.CONTINUE_TRAVERSAL;
        }
      });
      parameters.remove(getHiddenFieldId());
    }
  }
View Full Code Here

   *      java.util.Map)
   */
  @Override
  protected ValueMap decodeParameters(String urlFragment, Map<String, ?> 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

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.