Class UploadResource


  • @Path("/upload")
    @Consumes("multipart/form-data")
    @Produces("text/html; charset=utf-8")
    @Controller
    public class UploadResource
    extends java.lang.Object

    Handle file uploads used in various features of Digital.ai Release.

    Upload URIs are not secured, because with IE the upload component falls back to an iframe, where we cannot pass authentication headers. In order to limit the risk of exposing unsecured URIs, we make them temporary: before performing an upload, the client requests a one-time token, that it must append to the URI it submits to.

    Results must be TEXT_PLAIN because of IE9 iframe download handling, ZIP type makes IE believes it's a download of zip file.
    • Constructor Summary

      Constructors 
      Constructor Description
      UploadResource()  
      UploadResource​(com.xebialabs.xlrelease.security.PermissionChecker permissionChecker, com.xebialabs.xlrelease.export.TemplateImporter templateImporter, UploadService uploadService)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<AttachmentView> addAttachment​(java.lang.String ciId, javax.servlet.http.HttpServletRequest request)  
      TemplateLogoView addLogo​(java.lang.String templateId, javax.servlet.http.HttpServletRequest request)  
      java.util.List<com.xebialabs.xlrelease.views.ImportResult> importTemplates​(javax.servlet.http.HttpServletRequest request, java.lang.String folderId)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UploadResource

        @Autowired
        public UploadResource​(com.xebialabs.xlrelease.security.PermissionChecker permissionChecker,
                              com.xebialabs.xlrelease.export.TemplateImporter templateImporter,
                              UploadService uploadService)
      • UploadResource

        public UploadResource()
    • Method Detail

      • importTemplates

        @POST
        @Timed
        @Path("templates/zip")
        public java.util.List<com.xebialabs.xlrelease.views.ImportResult> importTemplates​(@Context
                                                                                          javax.servlet.http.HttpServletRequest request,
                                                                                          @QueryParam("folderId")
                                                                                          java.lang.String folderId)
                                                                                   throws java.io.IOException,
                                                                                          org.apache.commons.fileupload.FileUploadException
        Throws:
        java.io.IOException
        org.apache.commons.fileupload.FileUploadException
      • addAttachment

        @POST
        @Timed
        @Path("attachment/{ciId}")
        public java.util.List<AttachmentView> addAttachment​(@PathParam("ciId")
                                                            java.lang.String ciId,
                                                            @Context
                                                            javax.servlet.http.HttpServletRequest request)
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • addLogo

        @POST
        @Timed
        @Path("logo/{templateId:.*Release[^/-]*}")
        public TemplateLogoView addLogo​(@PathParam("templateId")
                                        java.lang.String templateId,
                                        @Context
                                        javax.servlet.http.HttpServletRequest request)
                                 throws java.io.IOException
        Throws:
        java.io.IOException