Package org.exoplatform.download

Examples of org.exoplatform.download.DownloadService


   {

      public void execute(Event<UISampleDownloadUpload> event) throws Exception
      {
         UISampleDownloadUpload uiForm = event.getSource();
         DownloadService dservice = uiForm.getApplicationComponent(DownloadService.class);
         String[] downloadLink = new String[3];
         String[] fileName = new String[3];
         String[] inputName = new String[3];
         for (int index = 0; index <= 2; index++)
         {
            UIFormUploadInput input = uiForm.getChildById("name" + index);
            UploadResource uploadResource = input.getUploadResource();
            if (uploadResource != null)
            {
               DownloadResource dresource =
                  new InputStreamDownloadResource(input.getUploadDataAsStream(), uploadResource.getMimeType());
               dresource.setDownloadName(uploadResource.getFileName());
               downloadLink[index] = dservice.getDownloadLink(dservice.addDownloadResource(dresource));
               fileName[index] = uploadResource.getFileName();
               inputName[index] = "name" + index;
            }
         }
View Full Code Here


    public static class SubmitActionListener extends EventListener<UISampleDownloadUpload> {

        public void execute(Event<UISampleDownloadUpload> event) throws Exception {
            UISampleDownloadUpload uiForm = event.getSource();
            DownloadService dservice = uiForm.getApplicationComponent(DownloadService.class);
            List<String> downloadLink = new ArrayList<String>();
            List<String> fileName = new ArrayList<String>();
            List<String> inputName = new ArrayList<String>();
            for (int index = 0; index <= 2; index++) {
                UIFormUploadInput input = uiForm.getChildById("name" + index);
                UploadResource uploadResource = input.getUploadResource();
                if (uploadResource != null) {
                    DownloadResource dresource = new InputStreamDownloadResource(input.getUploadDataAsStream(),
                            uploadResource.getMimeType());
                    dresource.setDownloadName(uploadResource.getFileName());
                    downloadLink.add(dservice.getDownloadLink(dservice.addDownloadResource(dresource)));
                    fileName.add(uploadResource.getFileName());
                    inputName.add("name" + index);
                }
            }

            for (int index = 3; index < 5; index++) {
                UIUploadInput input = uiForm.getChildById("name" + index);
                UploadResource[] uploadResources = input.getUploadResources();
                for (UploadResource uploadResource : uploadResources) {
                    DownloadResource dresource = new InputStreamDownloadResource(new FileInputStream(new File(
                            uploadResource.getStoreLocation())), uploadResource.getMimeType());
                    dresource.setDownloadName(uploadResource.getFileName());
                    downloadLink.add(dservice.getDownloadLink(dservice.addDownloadResource(dresource)));
                    fileName.add(uploadResource.getFileName());
                    inputName.add("name" + index);
                }
            }
View Full Code Here

    public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception {
        String resourceId = req.getParameter("resourceId");
        res.setHeader("Cache-Control", "private max-age=600, s-maxage=120");
        ExoContainer container = ExoContainerContext.getCurrentContainer();
        DownloadService dservice = (DownloadService) container.getComponentInstanceOfType(DownloadService.class);
        DownloadResource dresource = dservice.getDownloadResource(resourceId);
        if (dresource == null) {
            res.setContentType("text/plain");
            res.getWriter().write("NO DOWNDLOAD RESOURCE CONTENT  OR YOU DO NOT HAVE THE RIGHT TO ACCESS THE CONTENT");
            return;
        }
View Full Code Here

   public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
   {
      String resourceId = req.getParameter("resourceId");
      res.setHeader("Cache-Control", "private max-age=600, s-maxage=120");
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      DownloadService dservice = (DownloadService)container.getComponentInstanceOfType(DownloadService.class);
      DownloadResource dresource = dservice.getDownloadResource(resourceId);
      if (dresource == null)
      {
         res.setContentType("text/plain");
         res.getWriter().write("NO DOWNDLOAD RESOURCE CONTENT  OR YOU DO NOT HAVE THE RIGHT TO ACCESS THE CONTENT");
         return;
View Full Code Here

   @SuppressWarnings("unused")
   public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
   {
      res.setHeader("Cache-Control", "private max-age=600, s-maxage=120");
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      DownloadService dservice = (DownloadService)container.getComponentInstanceOfType(DownloadService.class);
      DownloadResource dresource = dservice.getDownloadResource(resourceId);
      if (dresource == null)
      {
         res.setContentType("text/plain");
         res.getWriter().write("NO DOWNDLOAD RESOURCE CONTENT  OR YOU DO NOT HAVE THE RIGHT TO ACCESS THE CONTENT");
         return;
View Full Code Here

TOP

Related Classes of org.exoplatform.download.DownloadService

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.