Package org.apache.wicket.util.resource

Examples of org.apache.wicket.util.resource.FileResourceStream


    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
    bindToApplicationAsResourceAndRequestIt(new FileResourceStream(
      new org.apache.wicket.util.file.File(testFile)));
    assertEquals(MockHttpServletResponse.formatDate(testFile.lastModified()),
      tester.getLastModifiedFromResponseHeader());
    assertEquals(TEST_STRING.length(), tester.getContentLengthFromResponseHeader());
  }
View Full Code Here


    for (Folder folder : folders)
    {
      final File file = new File(folder, pathname);
      if (file.exists())
      {
        return new FileResourceStream(file);
      }
    }

    for (String path : webappPaths)
    {
View Full Code Here

      throw new IllegalStateException(getClass().getName() +
        " failed to retrieve a File object from model");
    }
    final String fn = (fileName != null) ? fileName : file.getName();

    IResourceStream resourceStream = new FileResourceStream(
      new org.apache.wicket.util.file.File(file));
    getRequestCycle().setRequestTarget(new ResourceStreamRequestTarget(resourceStream)
    {
      @Override
      public String getFileName()
View Full Code Here

      private static final long serialVersionUID = 1L;

      public IResourceStream getResourceStream()
      {
        return new FileResourceStream(new org.apache.wicket.util.file.File(testFile));
      }
    };
    resource.onResourceRequested();
    tester.processRequestCycle(cycle);
View Full Code Here

       */
      private static final long serialVersionUID = 1L;

      public IResourceStream getResourceStream()
      {
        return new FileResourceStream(new org.apache.wicket.util.file.File(testFile));
      }
    };
    resource.setCacheable(false);
    resource.onResourceRequested();
    tester.processRequestCycle(cycle);
View Full Code Here

    }

    @Override
    public IResourceStream getResourceStream()
    {
      return new FileResourceStream(file);
    }
View Full Code Here

                " failed to retrieve a File object from model");
        }

        String fileName = UrlEncoder.QUERY_INSTANCE.encode(this.xlsxFileName, getRequest().getCharset());

        final IResourceStream resourceStream = new FileResourceStream(
            new org.apache.wicket.util.file.File(file)) {
           
            private static final long serialVersionUID = 1L;

            @Override
View Full Code Here

      LOG.debug("new PicnikExamplePage in Session " + getSession().getId() + " from "  + ((WebRequest)getRequest()).getHttpServletRequest().getRemoteAddr());
     
      final NonCachingImage nonCachingImage1 = new NonCachingImage("picnikImage1", new WebResource() {
      @Override
      public IResourceStream getResourceStream() {
        return new FileResourceStream(imageFile1);
      }
      });
      nonCachingImage1.setOutputMarkupId(true);
    add(nonCachingImage1);

      PullPanel pullPanel = new PullPanel("pullPanel") {
      @Override
      protected Form createForm(String id, IModel model) {
        return new Form(id, model) {
          @Override
          protected void onSubmit() {
            PicnikFileUpload upload = (PicnikFileUpload) getModelObject();
           
              LOG.debug("File received in Session " + getSession().getId() + " from "  + ((WebRequest)getRequest()).getHttpServletRequest().getRemoteAddr());
             
            FileUpload fileUpload = upload.getFileUpload();
            if (fileUpload != null) {
              LOG.debug("Size: " + fileUpload.getSize());
              LOG.debug("Name: " + fileUpload.getClientFileName());
              LOG.debug("Type: " + fileUpload.getContentType());
              try {
                fileUpload.writeTo(imageFile1);
              } catch (IOException e) {
                throw new WicketRuntimeException(e);
              }
              // following line is actually only required when doing the modal way
              setResponsePage(CloseModalPage.class);             
            }           
          }
        };
      }
      };
      add(pullPanel);

      PicnikCall call1 = new PicnikCall();
      call1.getGeneralSettings().setApiKey(picnikApi);

      ExportSettings exportSettings1 = pullPanel.getExportSettings();
      exportSettings1.setTitle("Wicket!");
    call1.setExportSettings(exportSettings1);
   
    NavigationSettings navSettings = new NavigationSettings();
    navSettings.setPage("/in/upload");
    call1.setNavigationSettings(navSettings);
   
      PicnikLinkModel picnikLinkModel1 = new PicnikLinkModel(call1);
    ExternalLink picnikLink1 = new ExternalLink("importLink1", picnikLinkModel1);
    add(picnikLink1);
     
    final Image logoImage = new Image("logoImage", new ResourceReference(PullPanel.class, "picnik_logo_small.jpg"));
    picnikLink1.add(logoImage);

      // ========================================================================
    // same thing, but in modal window
      PicnikCall call3 = new PicnikCall();
      call3.getGeneralSettings().setApiKey(picnikApi);
      call3.getImportSettings().setImportSource("http://www.indyphone.de/static/media/89e9e0a2-0d17-49db-97fb-e46a2e8c68ea.png");
     
      NavigationSettings navSettings3 = new NavigationSettings();
      navSettings3.setPage("/edit");
     
      ExportSettings exportSettings3 = pullPanel.getExportSettings();
      exportSettings3.setTitle("Wicket!");
    call3.setExportSettings(exportSettings3);
   
    BoxSettings boxSettings3 = new BoxSettings();
    boxSettings3.setExpandButton(false);
    boxSettings3.setCloseTarget("http://rue.dnsdojo.net:42000/wicketstuff-picnik/");
     
      PicnikLinkModel picnikLinkModel3 = new PicnikLinkModel(call3);
     
    ModalPicnikLink modalPicnikLink = new ModalPicnikLink("modalPicnikLink", picnikLinkModel3)
    {
      @Override
      protected void onPicnikFinished(AjaxRequestTarget target) {
              target.addComponent(nonCachingImage1);
      }
     
    };
    add(modalPicnikLink);
   
      // ========================================================================

      final NonCachingImage picnikImage2 = new NonCachingImage("picnikImage2", new WebResource() {
      @Override
      public IResourceStream getResourceStream() {
        return new FileResourceStream(imageFile2);
      }
      });
      picnikImage2.setOutputMarkupId(true);
    add(picnikImage2);
     
View Full Code Here

      }

      add(new NonCachingImage("picnikImage2", new WebResource() {
      @Override
      public IResourceStream getResourceStream() {
        return new FileResourceStream(imageFile2);
      }
      }));
     
      PushTargetPanel pushtarget = new PushTargetPanel("pushtargetPanel") {
      /**
 
View Full Code Here

      return EmptyRequestTarget.getInstance();
    }
    if (!file.exists() || srcfile.lastModified() > file.lastModified()) {
      imageConverter.scaleImage(srcfile, file, size, null);
    }
    IResourceStream fileResource = new FileResourceStream(new org.apache.wicket.util.file.File(file)){
      @Override
      public String getContentType() {
        return "image/jpeg";
      }
    };
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.resource.FileResourceStream

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.