Class FileService


  • @Path("/files/")
    public class FileService
    extends Object
    This bean provides the REST service retrieve and store documents. It handles the REST specific part but delegates the content retrieval and storage to a backing ContentStore implementation.

    Please consult the swagger documentation for further details about the methods exposed via REST.

    Since:
    jadice server 5.6.0.0
    • Constructor Detail

      • FileService

        public FileService​(ContentStore contentStore)
    • Method Detail

      • storeFile

        @POST
        @Consumes({"multipart/form-data","application/x-www-form-urlencoded"})
        @Produces("text/plain")
        public String storeFile​(org.apache.cxf.jaxrs.ext.multipart.Attachment file,
                                @Context
                                javax.servlet.http.HttpServletResponse response)
                         throws Exception
        Upload a file to the REST service.
        Throws:
        Exception
      • buildStreamDescriptor

        protected StreamDescriptor buildStreamDescriptor​(org.apache.cxf.jaxrs.ext.multipart.Attachment att)
        Build a StreamDescriptor that contains the filename, MIME type and description based on the Attachment's header fields.
        Parameters:
        att - the Attachment to handle
        Returns:
        a StreamDescriptor that contains the relevant information
      • retrieveFile

        @GET
        @Path("{fileId}")
        @Produces("application/octet-stream")
        public InputStream retrieveFile​(@PathParam("fileId")
                                        String fileId,
                                        @Context
                                        javax.servlet.http.HttpServletRequest request,
                                        @Context
                                        javax.servlet.http.HttpServletResponse response)
                                 throws IOException
        Download a file from the REST service
        Throws:
        IOException
      • deleteFile

        @DELETE
        @Path("{fileId}")
        public void deleteFile​(@PathParam("fileId")
                               String fileId,
                               @Context
                               javax.servlet.http.HttpServletRequest request,
                               @Context
                               javax.servlet.http.HttpServletResponse response)
                        throws IOException
        Delete a file from the REST service.
        Throws:
        IOException
      • setContentStore

        public void setContentStore​(ContentStore contentStore)
        Set the backing ContentStore implementation