1 Reply Latest reply on Oct 28, 2014 4:27 AM by Jean-Frederic Clere

    RestEasy: How to get the original filename using @MultipartForm

    krishna chaitanya Newbie

      I am using resteasy 3.0.6.Final I am trying to upload a file and access the content-disposition header in my POJO. Below is my POJO.

       

      public class SoftwarePackageForm {

       

       

          @FormParam("softwarePackage")

          private File file;

          //I want to inject the contentDisposition here or the originalFileName with extention

          //@?????("Content-Disposition/filename")

          private String contentDisposition;

       

       

          public File getFile() {

              return file;

          }

       

          public void setFile(File file) {

              this.file = file;

          }

       

          public String getContentDisposition() {

              return contentDisposition;

          }

       

          public void setContentDisposition(String contentDisposition) {

              this.contentDisposition = contentDisposition;

          }

      }

      I am getting null when I access softwarePackageForm.getContentDisposition().

       

      I tried with @FormParam("Content-Disposition") and @HeaderParam("Content-Disposition") and @HeaderParam with a combination of @PartType("application/octet-stream"). All trials resulted in the same null.

       

      How can I get the original file name when using @MultipartForm. Can anyone please let me know if this possible and how?

       

      Thank you all in advance.