Package org.apache.wicket.request.resource

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


        }
        return null;
    }

    private static PackageResourceReference newPackageResourceReference(final String imageFile) {
        return new PackageResourceReference(Images.class, imageFile);
    }
View Full Code Here


   * @throws Exception
   */
  @Test
  public void lenientPackageResourceMatching() throws Exception
  {
    ResourceReference invalidResource = new PackageResourceReference(PackageResourceTest.class,
      "i_do_not_exist.txt", Locale.ENGLISH, null, null);
    assertNotNull(
      "resource i_do_not_exist.txt SHOULD be available as a packaged resource even if it doesn't exist",
      invalidResource.getResource());

    assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", null, null,
      null));
    assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", Locale.CHINA,
      null, null));
View Full Code Here

      this.attribute = attribute;
      // Check whether it is a valid resource reference
      if (PackageResource.exists(clazz, href, getLocale(), getStyle(), getVariation()))
      {
        // Create the component implementing the link
        resourceReference = new PackageResourceReference(clazz, href, getLocale(),
          getStyle(), getVariation());
        }
        else
        {
          // The resource does not exist. Set to null and ignore when
View Full Code Here

   */
  @Test
  public void resourceReference()
  {
    ImageStatelessPage page = new ImageStatelessPage();
    final Image i = new Image("test", new PackageResourceReference("test"));
    page.add(i);
    tester.startPage(page);
    assertTrue("image with resource reference should be stateless", i.isStateless());
  }
View Full Code Here

  @Override
  protected ResourceReference getImageResourceReference()
  {
    // TODO: need better image for this:
    return new PackageResourceReference(SessionSizeDebugPanel.class, "harddrive.png");
  }
View Full Code Here

    // the page will render just <script> element with url to the template
    // this will register it in the application's ResourceReferenceRegistry
    Page page = tester.startPage(new TemplateResourceReferencePage());

    // make a separate request to the template resource
    CharSequence urlForTemplate = page.urlFor(new PackageResourceReference(
      TextTemplateResourceReferenceTest.class, TEMPLATE_NAME), null);
    tester.executeUrl(urlForTemplate.toString());
    tester.assertContains("TMPL_START\\|" + EXPECTED_VALUE + "\\|TMPL_END");
  }
View Full Code Here

  private CharSequence renderTemplate(final TextTemplate template)
  {
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("name", name);

    CharSequence relativeUrl = urlFor(new PackageResourceReference(MailTemplate.class,
      "resource.txt"), null);
    String href = getRequestCycle().getUrlRenderer().renderFullUrl(
      Url.parse(relativeUrl.toString()));
    variables.put("downloadLink", href);
View Full Code Here

    if (parent instanceof Border)
    {
      parent = parent.getParent();
    }
    final Class<?> scope = parent.getClass();
    resourceReference = new PackageResourceReference(scope, path, locale, style, variation);
    bind();
  }
View Full Code Here

          application.getResourceReferenceRegistry().registerResourceReference(ref);
        }

        // Create resource reference
        resourceReference = new PackageResourceReference(Application.class,
          imageReferenceName, locale, style, variation);
      }
      else
      {
        resource = getResourceFactory(application, factoryName).newResource(specification,
View Full Code Here

   * Relative ResourceReferences, WICKET-3514
   */
  @Test
  public void resourceReference()
  {
    PackageResourceReference resource = new PackageResourceReference(getClass(),
      "crypt/crypt.txt");
    Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));

    Request request = getRequest(url);

View Full Code Here

TOP

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

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.