Package org.apache.wicket.request.target.coding

Examples of org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy


      {
        final Map.Entry entry = (Entry)it.next();
        final String key = (String)entry.getKey();
        if (path.startsWith(key))
        {
          IRequestTargetUrlCodingStrategy strategy = (IRequestTargetUrlCodingStrategy)entry
              .getValue();
          if (strategy.matches(path))
          {
            return strategy;
          }
        }
      }
View Full Code Here


      {
        return mountsOnPath.strategyForMount(null);
      }
      else
      {
        IRequestTargetUrlCodingStrategy strategy = mountsOnPath.strategyForPath(path);
        if (strategy != null && !(strategy instanceof PassThroughUrlCodingStrategy))
        {
          return strategy;
        }
      }
View Full Code Here

   * @see org.apache.wicket.request.IRequestCodingStrategy#pathForTarget(org.apache.wicket.IRequestTarget)
   */
  public CharSequence pathForTarget(IRequestTarget requestTarget)
  {
    // first check whether the target was mounted
    IRequestTargetUrlCodingStrategy encoder = getMountEncoder(requestTarget);
    if (encoder != null)
    {
      return encoder.encode(requestTarget);
    }
    return null;
  }
View Full Code Here

  /**
   * @see org.apache.wicket.request.IRequestCodingStrategy#targetForRequest(org.apache.wicket.request.RequestParameters)
   */
  public IRequestTarget targetForRequest(RequestParameters requestParameters)
  {
    IRequestTargetUrlCodingStrategy encoder = urlCodingStrategyForPath(requestParameters.getPath());
    if (encoder == null)
    {
      return null;
    }
    return encoder.decode(requestParameters);
  }
View Full Code Here

      for (Entry<String, IRequestTargetUrlCodingStrategy> entry : map.entrySet())
      {
        final String key = entry.getKey();
        if (path.startsWith(key))
        {
          IRequestTargetUrlCodingStrategy strategy = entry.getValue();
          if (strategy.matches(path, caseSensitiveMounts))
          {
            return strategy;
          }
        }
      }
View Full Code Here

      {
        return mountsOnPath.strategyForMount(null);
      }
      else
      {
        IRequestTargetUrlCodingStrategy strategy = mountsOnPath.strategyForPath(path);
        if (strategy != null && !(strategy instanceof PassThroughUrlCodingStrategy))
        {
          return strategy;
        }
      }
View Full Code Here

   * @see org.apache.wicket.request.IRequestCodingStrategy#pathForTarget(org.apache.wicket.IRequestTarget)
   */
  public CharSequence pathForTarget(IRequestTarget requestTarget)
  {
    // first check whether the target was mounted
    IRequestTargetUrlCodingStrategy encoder = getMountEncoder(requestTarget);
    if (encoder != null)
    {
      return encoder.encode(requestTarget);
    }
    return null;
  }
View Full Code Here

  /**
   * @see org.apache.wicket.request.IRequestCodingStrategy#targetForRequest(org.apache.wicket.request.RequestParameters)
   */
  public IRequestTarget targetForRequest(RequestParameters requestParameters)
  {
    IRequestTargetUrlCodingStrategy encoder = urlCodingStrategyForPath(requestParameters.getPath());
    if (encoder == null)
    {
      return null;
    }
    return encoder.decode(requestParameters);
  }
View Full Code Here

  {
    final String pathInfo = getRelativePath(servletRequest);
    if (Strings.isEmpty(pathInfo))
      return -1;

    IRequestTargetUrlCodingStrategy sharedResourceMount = null;
    boolean sharedResource = pathInfo.startsWith(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX);
    if (!sharedResource)
    {
      sharedResourceMount = webApplication.getRequestCycleProcessor()
        .getRequestCodingStrategy()
        .urlCodingStrategyForPath(pathInfo);
      sharedResource = sharedResourceMount instanceof SharedResourceRequestTargetUrlCodingStrategy;
    }

    if (sharedResource)
    {
      Resource resource = null;
      WebRequestCycle requestCycle = null;

      boolean externalCall = !Application.exists();
      try
      {
        // if called externally (i.e. WicketServlet) we need to set the thread local here
        // AND clean it up at the end of the request
        if (externalCall)
        {
          Application.set(webApplication);
        }

        final String resourceReferenceKey;
        if (sharedResourceMount != null)
        {
          resourceReferenceKey = ((SharedResourceRequestTargetUrlCodingStrategy)sharedResourceMount).getResourceKey();
        }
        else
        {
          resourceReferenceKey = WicketURLDecoder.PATH_INSTANCE.decode(pathInfo.substring(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX.length()));
        }


        // Try to find shared resource
        resource = webApplication.getSharedResources().get(resourceReferenceKey);

        // If resource found and it is cacheable
        if ((resource != null) && resource.isCacheable())
        {
          // first check the char encoding for getting the parameters
          checkCharacterEncoding(servletRequest);

          final WebRequest request = webApplication.newWebRequest(servletRequest);
          WebResponse response = new WebResponse();
          // create a request cycle if not already there.
          if (RequestCycle.get() == null)
          {
            requestCycle = (WebRequestCycle)webApplication.newRequestCycle(request,
              response);
          }
          // make the session available.
          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);
          if (sharedResourceMount != null)
          {
            sharedResourceMount.decode(rp);
          }
          // Set parameters from servlet request
          resource.setParameters(rp.getParameters());

          // Get resource stream
View Full Code Here

      for (Entry<String, IRequestTargetUrlCodingStrategy> entry : map.entrySet())
      {
        final String key = entry.getKey();
        if (path.startsWith(key))
        {
          IRequestTargetUrlCodingStrategy strategy = entry.getValue();
          if (strategy.matches(path, caseSensitiveMounts))
          {
            return strategy;
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy

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.