Package org.apache.wicket.request.resource

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


  @Test
  public void clickResourceLinkWithResourceReference()
  {
    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()
View Full Code Here


            getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
            label = "Downloading: " + clob.getName();
        } else if(value instanceof Blob) {
            final Blob blob = (Blob) value;
            ResourceRequestHandler handler =
                    new ResourceRequestHandler(new ByteArrayResource(blob.getMimeType().toString(), blob.getBytes(), blob.getName()), null);
            getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
            label = "Downloading: " + blob.getName();
        } else {
            label = objectAdapter.titleString(null);
        }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void urlForDynamicResource() throws Exception
  {
    ByteArrayResource resource = new ByteArrayResource(null, new byte[] {1, 2}, "test.bin");
    ResourceRequestHandler handler = new ResourceRequestHandler(resource, new PageParameters());
    CharSequence url = requestCycle.urlFor(handler);
    assertEquals("./"+RESOURCE_URL + JSESSIONID, url);
  }
View Full Code Here

  @Test
  public void clickResourceLinkWithResource()
  {
    MockPageWithLink page = new MockPageWithLink();
    String content = "content";
    ByteArrayResource resource = new ByteArrayResource("text/plain", content.getBytes(),
      "fileName.txt");
    ResourceLink<Void> link = new ResourceLink<Void>(MockPageWithLink.LINK_ID, resource);
    page.add(link);
    tester.startPage(page);
    tester.clickLink(MockPageWithLink.LINK_ID, false);
View Full Code Here

  @Test
  public void clickResourceLinkWithResourceReference()
  {
    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()
View Full Code Here

          try {
            exporter.exportPivot(getPivotModel(), out);
          } catch (IOException e) {
            throw new RuntimeException(e);
          }
          ResourceRequestHandler downloadHandler = new ResourceRequestHandler(new ByteArrayResource(
              exporter.getFormatMimetype(), out.toByteArray(), pivotExportFilename + "."
                  + exporter.getFilenameExtension()), null);
          RequestCycle.get().scheduleRequestHandlerAfterCurrent(downloadHandler);
        }
      };
View Full Code Here

  @Test
  public void clickResourceLink()
  {
    MockPageWithLink page = new MockPageWithLink();
    String content = "content";
    ByteArrayResource resource = new ByteArrayResource("text/plain", content.getBytes(),
      "fileName.txt");
    ResourceLink<Void> link = new ResourceLink<Void>(MockPageWithLink.LINK_ID, resource);
    page.add(link);
    tester.startPage(page);
    tester.clickLink(MockPageWithLink.LINK_ID, false);
View Full Code Here

   * @throws Exception
   */
  @Test
  public void urlForDynamicResource() throws Exception
  {
    ByteArrayResource resource = new ByteArrayResource(null, new byte[] {1, 2}, "test.bin");
    ResourceRequestHandler handler = new ResourceRequestHandler(resource, new PageParameters());
    CharSequence url = requestCycle.urlFor(handler);
    assertEquals(RESOURCE_URL + JSESSIONID, url);
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void urlForDynamicResource() throws Exception
  {
    ByteArrayResource resource = new ByteArrayResource(null, new byte[] {1, 2}, "test.bin");
    ResourceRequestHandler handler = new ResourceRequestHandler(resource, new PageParameters());
    CharSequence url = requestCycle.urlFor(handler);
    assertEquals('.'+RESOURCE_URL + JSESSIONID, url);
  }
View Full Code Here

  @Test
  public void clickResourceLink()
  {
    MockPageWithLink page = new MockPageWithLink();
    String content = "content";
    ByteArrayResource resource = new ByteArrayResource("text/plain", content.getBytes(),
      "fileName.txt");
    ResourceLink<Void> link = new ResourceLink<Void>(MockPageWithLink.LINK_ID, resource);
    page.add(link);
    tester.startPage(page);
    tester.clickLink(MockPageWithLink.LINK_ID, false);
View Full Code Here

TOP

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

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.