Package org.apache.wicket.request.resource

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


      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


      public void respond(Attributes attributes)
      {
      }
    };

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

      @Override
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 packaged3.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

        return new DecoratingHeaderResponse(response)
        {
          @Override
          public void renderJavaScriptReference(ResourceReference reference, String id)
          {
            super.renderJavaScriptReference(new PackageResourceReference("DECORATED-" +
              reference.getName()), id);
          }
        };
      }
    });
View Full Code Here

    @Override
    public void renderHead(IHeaderResponse response)
    {
      for (int i = 0; i < 10; i++)
      {
        response.renderJavaScriptReference(new PackageResourceReference("res" + i),
          Integer.toString(i));
      }
    }
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

      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        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

   * 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

   * Relative ResourceReferences, WICKET-3514
   */
  @Test
  public void resourceReferenceWithModifiedSegments()
  {
    PackageResourceReference resource = new PackageResourceReference(getClass(),
      "crypt/crypt.txt");
    Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));
    url.getSegments().remove(url.getSegments().size() - 1);
    url.getSegments().add("modified-crypt.txt");

View Full Code Here

   * Relative ResourceReferences, WICKET-3514
   */
  @Test
  public void resourceReferenceWithMoreSegments()
  {
    PackageResourceReference resource = new PackageResourceReference(getClass(),
      "crypt/crypt.txt");
    Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));
    url.getSegments().remove(url.getSegments().size() - 1);
    url.getSegments().add("more");
    url.getSegments().add("more-crypt.txt");
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.