Package org.apache.wicket.request

Examples of org.apache.wicket.request.RequestParameters


   */
  private void dispatchEvent(final Page page, final String url)
  {
    RequestCycle rc = RequestCycle.get();
    IRequestCycleProcessor processor = rc.getProcessor();
    final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode(
      new FormDispatchRequest(rc.getRequest(), url));
    IRequestTarget rt = processor.resolve(rc, requestParameters);
    if (rt instanceof IListenerInterfaceRequestTarget)
    {
      IListenerInterfaceRequestTarget interfaceTarget = ((IListenerInterfaceRequestTarget)rt);
      interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget());
    }
    else
    {
      throw new WicketRuntimeException(
        "Attempt to access unknown request listener interface " +
          requestParameters.getInterfaceName());
    }
  }
View Full Code Here


   */
  private void dispatchEvent(final Page page, final String url)
  {
    RequestCycle rc = RequestCycle.get();
    IRequestCycleProcessor processor = rc.getProcessor();
    final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode(
      new FormDispatchRequest(rc.getRequest(), url));
    IRequestTarget rt = processor.resolve(rc, requestParameters);
    if (rt instanceof IListenerInterfaceRequestTarget)
    {
      IListenerInterfaceRequestTarget interfaceTarget = ((IListenerInterfaceRequestTarget)rt);
      interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget());
    }
    else
    {
      throw new WicketRuntimeException(
        "Attempt to access unknown request listener interface " +
          requestParameters.getInterfaceName());
    }
  }
View Full Code Here

          Session.findOrCreate(request, response);


          // decode the parameters so that shared resource params are also decoded
          // a request cycle is then needed. (see above)
          RequestParameters rp = RequestCycle.get()
            .getProcessor()
            .getRequestCodingStrategy()
            .decode(request);
          // Set parameters from servlet request
          resource.setParameters(rp.getParameters());

          // Get resource stream
          IResourceStream stream = resource.getResourceStream();

          // Get last modified time from stream
View Full Code Here

   */
  public final RequestParameters decode(final Request request)
  {
    try
    {
      final RequestParameters parameters = new RequestParameters();
      final String pathInfo = getRequestPath(request);
      parameters.setPath(pathInfo);
      parameters.setPageMapName(request.getParameter(PAGEMAP));
      addInterfaceParameters(request, parameters);
      addBookmarkablePageParameters(request, parameters);
      addResourceParameters(request, parameters);
      if (request.getParameter(IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME) != null)
      {
        parameters.setOnlyProcessIfPathActive(true);
      }

      Map<String, String[]> map = request.getParameterMap();
      Iterator<String> iterator = map.keySet().iterator();
      // remove the parameters with a wicket namespace prefix from the paramter list
      while (iterator.hasNext())
      {
        String key = iterator.next();
        if (key.startsWith(NAME_SPACE))
        {
          iterator.remove();
        }
      }
      parameters.setParameters(map);
      parameters.setQueryString(request.getQueryString());
      return parameters;
    }
    catch (WicketRuntimeException e)
    {
      throw new InvalidUrlException(e);
View Full Code Here

      url.append(listenerName);
    }
    url.append(Component.PATH_SEPARATOR);

    // Add behaviourId
    RequestParameters params = requestTarget.getRequestParameters();
    if (params != null && params.getBehaviorId() != null)
    {
      url.append(params.getBehaviorId());
    }
    url.append(Component.PATH_SEPARATOR);

    // Add URL depth
    if (params != null && params.getUrlDepth() != 0)
    {
      url.append(params.getUrlDepth());
    }

    if (IActivePageBehaviorListener.INTERFACE.getName().equals(listenerName))
    {
      url.append(url.indexOf("?") > -1 ? "&" : "?").append(
View Full Code Here

  {
    final RequestCycle cycle = getRequestCycle();
    String pageMapName = null;
    if (cycle != null)
    {
      RequestParameters parameters = getRequest().getRequestParameters();
      pageMapName = parameters.getPageMapName();
    }

    final IPageMap pageMap = PageMap.forName(pageMapName);
    init(pageMap);
  }
View Full Code Here

    if (index == -1)
    {
      throw new IllegalArgumentException("Behavior " + this +
        " was not registered with this component: " + component.toString());
    }
    RequestParameters params = new RequestParameters();
    params.setBehaviorId(String.valueOf(index));
    if (request instanceof ServletWebRequest)
    {
      ServletWebRequest swr = (ServletWebRequest)request;
      // If we're coming in with an existing depth, use it. Otherwise,
      // compute from the URL. This provides correct behavior for repeated
      // AJAX requests: If we need to generate a URL within an AJAX
      // request for another one, it needs to be at the same depth as the
      // original AJAX request.
      int urlDepth = swr.getRequestParameters().getUrlDepth();
      params.setUrlDepth(urlDepth > -1 ? urlDepth : swr.getDepthRelativeToWicketHandler());
    }

    final IRequestTarget target = new BehaviorRequestTarget(component.getPage(), component,
      listener, params);
    return encodeUrlFor(target);
View Full Code Here

   *            The parameters to pass to the resource.
   * @return The url for the shared resource
   */
  public final CharSequence urlFor(final ResourceReference resourceReference, ValueMap parameters)
  {
    RequestParameters requestParameters = new RequestParameters();
    requestParameters.setResourceKey(resourceReference.getSharedResourceKey());
    String name = resourceReference.getName();
    if (getApplication().getResourceSettings().getAddLastModifiedTimeToResourceReferenceUrl() &&
      !Strings.isEmpty(name) && !name.endsWith("/")) // test for / because it could be a
    // resource reference to a path..
    {
      Time time = resourceReference.lastModifiedTime();
      if (time != null)
      {
        if (parameters == null)
        {
          parameters = new ValueMap();
          parameters.put("w:lm", new Long(time.getMilliseconds() / 1000));
        }
      }
    }

    requestParameters.setParameters(parameters);
    return encodeUrlFor(new SharedResourceRequestTarget(requestParameters));
  }
View Full Code Here

    }
    catch (RuntimeException re)
    {
      // do set the parameters as it was parsed.
      // else the error page will also error again (infinite loop)
      requestParameters = new RequestParameters();
      throw re;
    }

    if (requestParameters == null)
    {
View Full Code Here

    {
      return null;
    }
    else
    {
      RequestParameters parameters = RequestCycle.get().getRequest().getRequestParameters();
      String oldPageMapName = parameters.getPageMapName();

      // if there is a pagemap name specified and multiwindow support is on
      if (getPageMapName() != null)
      {
        // try to find out whether the pagemap already exists
        Session session = Session.get();
        if (session.pageMapForName(getPageMapName(), false) == null)
        {
          deletePageMap = true;
        }
        parameters.setPageMapName(getPageMapName());
      }

      try
      {
        return pageCreator.createPage();
      }
      finally
      {
        parameters.setPageMapName(oldPageMapName);
      }
    }
  }
View Full Code Here

TOP

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

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.