Class FileProvider

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyReader<java.io.File>, javax.ws.rs.ext.MessageBodyWriter<java.io.File>

    @Provider
    @Produces("*/*")
    @Consumes("*/*")
    public class FileProvider
    extends java.lang.Object
    implements javax.ws.rs.ext.MessageBodyReader<java.io.File>, javax.ws.rs.ext.MessageBodyWriter<java.io.File>
    Version:
    $Revision: 1 $
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  FileProvider.FileHolder  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String _downloadDirectory  
      private static org.jboss.logging.Logger LOG  
      private static java.lang.String PREFIX  
      private static java.lang.String SUFFIX  
    • Constructor Summary

      Constructors 
      Constructor Description
      FileProvider()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getSize​(java.io.File o, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)  
      boolean isReadable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)  
      boolean isWriteable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)  
      java.io.File readFrom​(java.lang.Class<java.io.File> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders, java.io.InputStream entityStream)  
      protected void writeIt​(java.io.File uploadFile, java.io.OutputStream entityStream)  
      void writeTo​(java.io.File uploadFile, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders, java.io.OutputStream entityStream)  
      • Methods inherited from class java.lang.Object

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

      • LOG

        private static final org.jboss.logging.Logger LOG
      • _downloadDirectory

        private java.lang.String _downloadDirectory
    • Constructor Detail

      • FileProvider

        public FileProvider()
    • Method Detail

      • isReadable

        public boolean isReadable​(java.lang.Class<?> type,
                                  java.lang.reflect.Type genericType,
                                  java.lang.annotation.Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isReadable in interface javax.ws.rs.ext.MessageBodyReader<java.io.File>
      • readFrom

        public java.io.File readFrom​(java.lang.Class<java.io.File> type,
                                     java.lang.reflect.Type genericType,
                                     java.lang.annotation.Annotation[] annotations,
                                     javax.ws.rs.core.MediaType mediaType,
                                     javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders,
                                     java.io.InputStream entityStream)
                              throws java.io.IOException
        Specified by:
        readFrom in interface javax.ws.rs.ext.MessageBodyReader<java.io.File>
        Throws:
        java.io.IOException
      • isWriteable

        public boolean isWriteable​(java.lang.Class<?> type,
                                   java.lang.reflect.Type genericType,
                                   java.lang.annotation.Annotation[] annotations,
                                   javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isWriteable in interface javax.ws.rs.ext.MessageBodyWriter<java.io.File>
      • getSize

        public long getSize​(java.io.File o,
                            java.lang.Class<?> type,
                            java.lang.reflect.Type genericType,
                            java.lang.annotation.Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType)
        Specified by:
        getSize in interface javax.ws.rs.ext.MessageBodyWriter<java.io.File>
      • writeTo

        public void writeTo​(java.io.File uploadFile,
                            java.lang.Class<?> type,
                            java.lang.reflect.Type genericType,
                            java.lang.annotation.Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType,
                            javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders,
                            java.io.OutputStream entityStream)
                     throws java.io.IOException
        Specified by:
        writeTo in interface javax.ws.rs.ext.MessageBodyWriter<java.io.File>
        Throws:
        java.io.IOException
      • writeIt

        protected void writeIt​(java.io.File uploadFile,
                               java.io.OutputStream entityStream)
                        throws java.io.IOException
        Throws:
        java.io.IOException