Package org.apache.wicket.request.handler.resource

Examples of org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler


          .getResourceReference(scope, name.toString(), attributes.getLocale(),
            attributes.getStyle(), attributes.getVariation(), true, true);

        if (res != null)
        {
          return new ResourceReferenceRequestHandler(res, pageParameters);
        }
      }
    }
    return null;
  }
View Full Code Here


  @Override
  public Url mapHandler(IRequestHandler requestHandler)
  {
    if (requestHandler instanceof ResourceReferenceRequestHandler)
    {
      ResourceReferenceRequestHandler referenceRequestHandler = (ResourceReferenceRequestHandler)requestHandler;
      ResourceReference reference = referenceRequestHandler.getResourceReference();

      Url url;

      if (reference instanceof MetaInfStaticResourceReference)
      {
        url = ((MetaInfStaticResourceReference)reference).mapHandler(referenceRequestHandler);
        // if running on Servlet 3.0 engine url is not null
        if (url != null)
        {
          return url;
        }
        // otherwise it has to be served by the standard wicket way
      }

      url = new Url();

      List<String> segments = url.getSegments();
      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();
      }
View Full Code Here

  public ResourceReference startResourceReference(final ResourceReference reference,
    final PageParameters pageParameters)
  {
    // prepare request
    request.setURL(request.getContextPath() + request.getServletPath() + "/");
    IRequestHandler handler = new ResourceReferenceRequestHandler(reference, pageParameters);

    // execute request
    processRequest(request, handler);

    // the reference processed
View Full Code Here

   *            parameters for the resource or {@code null} if none
   * @return {@link Url} for the reference
   */
  public Url mapUrlFor(ResourceReference reference, PageParameters params)
  {
    return mapUrlFor(new ResourceReferenceRequestHandler(reference, params));
  }
View Full Code Here

   *            parameters for the resource or {@code null} if none
   * @return {@link Url} for the reference
   */
  public final CharSequence urlFor(ResourceReference reference, PageParameters params)
  {
    ResourceReferenceRequestHandler handler = new ResourceReferenceRequestHandler(reference,
      params);
    return renderUrl(mapUrlFor(handler), handler);
  }
View Full Code Here

    if (url != null)
    {
      String renderedUrl = getUrlRenderer().renderUrl(url);
      if (handler instanceof ResourceReferenceRequestHandler)
      {
        ResourceReferenceRequestHandler rrrh = (ResourceReferenceRequestHandler)handler;
        IResource resource = rrrh.getResource();
        if (resource instanceof IStaticCacheableResource == false)
        {
          renderedUrl = getOriginalResponse().encodeURL(renderedUrl);
        }
      }
View Full Code Here

    return "JavaScriptReferenceHeaderItem(" + getUrl() + ")";
  }

  private String getUrl()
  {
    IRequestHandler handler = new ResourceReferenceRequestHandler(getReference(),
      getPageParameters());
    return RequestCycle.get().urlFor(handler).toString();
  }
View Full Code Here

    Request request = getRequest(Url.parse(encrypted));

    IRequestHandler requestHandler = mapper.mapRequest(request);

    assertTrue(requestHandler instanceof ResourceReferenceRequestHandler);
    ResourceReferenceRequestHandler handler = (ResourceReferenceRequestHandler)requestHandler;

    assertEquals(getClass(), handler.getResourceReference().getScope());
    assertEquals("crypt/crypt.txt", handler.getResourceReference().getName());
  }
View Full Code Here

    Request request = getRequest(Url.parse(encrypted));

    IRequestHandler requestHandler = mapper.mapRequest(request);

    assertTrue(requestHandler instanceof ResourceReferenceRequestHandler);
    ResourceReferenceRequestHandler handler = (ResourceReferenceRequestHandler)requestHandler;

    assertEquals(getClass(), handler.getResourceReference().getScope());
    assertEquals("crypt/modified-crypt.txt", handler.getResourceReference().getName());
  }
View Full Code Here

    Request request = getRequest(Url.parse(encrypted));

    IRequestHandler requestHandler = mapper.mapRequest(request);

    assertTrue(requestHandler instanceof ResourceReferenceRequestHandler);
    ResourceReferenceRequestHandler handler = (ResourceReferenceRequestHandler)requestHandler;

    assertEquals(getClass(), handler.getResourceReference().getScope());
    assertEquals("crypt/more/crypt.txt", handler.getResourceReference().getName());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler

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.