Package org.apache.wicket.request.resource

Examples of org.apache.wicket.request.resource.ResourceReference


          // Resource not available yet, so create it with factory and
          // share via Application
          final IResource imageResource = getResourceFactory(application, factoryName).newResource(
            specification, locale, style, variation);

          ResourceReference ref = new SimpleStaticResourceReference(Application.class,
            imageReferenceName, locale, style, variation, imageResource);

          application.getResourceReferenceRegistry().registerResourceReference(ref);
        }
View Full Code Here


   *            Resource to store
   */
  public final void add(final Class<?> scope, final String name, final Locale locale,
    final String style, final String variation, final IResource resource)
  {
    ResourceReference ref = new SharedResourceReference(scope, name, locale, style, variation,
      resource);
    registry.registerResourceReference(ref);
  }
View Full Code Here

      {
        return true;
      }
    };

    final ResourceReference reference = new ResourceReference(getClass(), "versioned",
      Locale.ENGLISH, "style", null)
    {
      private static final long serialVersionUID = 1L;

      @Override
View Full Code Here

        if (pageId != NO_PAGE_ID)
        {
          page.send(application, Broadcast.BREADTH, payload);
        } else
        {
          ResourceReference reference = new SharedResourceReference(resourceName);
          IResource resource = reference.getResource();
          if (resource instanceof WebSocketResource)
          {
            WebSocketResource wsResource = (WebSocketResource) resource;
            wsResource.onPayload(payload);
          } else
View Full Code Here

  {
    MockPageWithLink page = new MockPageWithLink();
    String content = "content";
    final ByteArrayResource resource = new ByteArrayResource("text/plain", content.getBytes(),
        "fileName.txt");
    ResourceReference reference = new ResourceReference(WicketTesterTest.class, "resourceLinkWithResourceReferenceTest")
    {
      @Override
      public IResource getResource()
      {
        return resource;
View Full Code Here

  {
    super.renderHead(response);
    response.renderJavaScriptReference(WicketEventReference.INSTANCE);
    response.renderJavaScriptReference(WicketAjaxReference.INSTANCE);
    response.renderJavaScriptReference(JS);
    ResourceReference css = getCss();
    if (css != null)
    {
      response.renderCSSReference(css);
    }

    ResourceReference ref = new SharedResourceReference(RESOURCE_NAME);

    final String uploadFieldId = (uploadField == null) ? "" : uploadField.getMarkupId();

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    PrintStream js = new PrintStream(out);
View Full Code Here

   *            the resource to test
   * @return the used {@link ResourceReference} for the simulation
   */
  public ResourceReference startResource(final IResource resource)
  {
    return startResourceReference(new ResourceReference("testResourceReference")
    {
      private static final long serialVersionUID = 1L;

      @Override
      public IResource getResource()
View Full Code Here

      ResourceReference.UrlAttributes attributes = getResourceReferenceAttributes(url);

      Class<?> scope = resolveClass(className);
      if (scope != null)
      {
        ResourceReference res = getContext().getResourceReferenceRegistry()
          .getResourceReference(scope, name.toString(), attributes.getLocale(),
            attributes.getStyle(), attributes.getVariation(), true, true);

        if (res != null)
        {
View Full Code Here

  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();
      }
      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();
View Full Code Here

  {
    MockPageWithLink page = new MockPageWithLink();
    String content = "content";
    final ByteArrayResource resource = new ByteArrayResource("text/plain", content.getBytes(),
        "fileName.txt");
    ResourceReference reference = new ResourceReference(WicketTesterTest.class, "resourceLinkWithResourceReferenceTest")
    {
      @Override
      public IResource getResource()
      {
        return resource;
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.resource.ResourceReference

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.