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


      @Override
      protected void populateItem(final ListItem<Client> item) {
        Client client = item.getModelObject();
        final Long userId = client.getUser_id();
        item.add(new Image("clientImage", new ByteArrayResource("image/jpeg") {
          private static final long serialVersionUID = 6039580072791941591L;

          @Override
          protected ResourceResponse newResourceResponse(Attributes attributes) {
            ResourceResponse rr = super.newResourceResponse(attributes);
View Full Code Here

      //no-op
    }
    if (absolute) {
      profile.add(new Image("img", WebSession.getString(5L)).add(AttributeModifier.replace("src", uri)));
    } else {
      profile.add(new Image("img", new ByteArrayResource("image/jpeg") {
        private static final long serialVersionUID = 6039580072791941591L;

        @Override
        protected ResourceResponse newResourceResponse(Attributes attributes) {
          ResourceResponse rr = super.newResourceResponse(attributes);
View Full Code Here

      @Override
      protected void populateItem(final ListItem<Client> item) {
        Client client = item.getModelObject();
        final Long userId = client.getUser_id();
        item.add(new Image("clientImage", new ByteArrayResource("image/jpeg") {
          private static final long serialVersionUID = 6039580072791941591L;

          @Override
          protected ResourceResponse newResourceResponse(Attributes attributes) {
            ResourceResponse rr = super.newResourceResponse(attributes);
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

  /**
   *
   */
  public void testResource()
  {
    final Image i = new Image("test", new ByteArrayResource("text/text", new byte[0]));
    tester.startComponent(i);
    assertTrue("image with resource should be statefull", !i.isStateless());
  }
View Full Code Here

        final Blob blob = new Blob(clientFileName, contentType, bytes);
        return blob;
    }

    protected IResource newResource(final Blob blob) {
        return new ByteArrayResource(blob.getMimeType().getBaseType(), blob.getBytes(), blob.getName());
    }
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

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.