Class FileServer


  • @Path("/")
    public class FileServer
    extends java.lang.Object
    FileServer service class. This uses request streaming to save the submitted files in the server. Also this demonstrates how to respond with files.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileServer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.ws.rs.core.Response getFile​(java.lang.String fileName)
      Download file with streaming using a File object in the response.
      javax.ws.rs.core.Response getFileFromInputStream​(java.lang.String fileName)
      Download file with streaming using a InputStream object in the response.
      javax.ws.rs.core.Response getFileUsingStreamingOutput​(java.lang.String fileName)
      Download file with Streaming using using StreamingOutput.
      void postFile​(org.wso2.msf4j.HttpStreamer httpStreamer, java.lang.String fileName)
      Upload a file with streaming.
      • Methods inherited from class java.lang.Object

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

      • FileServer

        public FileServer()
    • Method Detail

      • postFile

        @POST
        @Path("/{fileName}")
        public void postFile​(@Context
                             org.wso2.msf4j.HttpStreamer httpStreamer,
                             @PathParam("fileName")
                             java.lang.String fileName)
                      throws java.io.IOException
        Upload a file with streaming.
        Parameters:
        httpStreamer - Handle for setting the HttpStreamHandlercallback for streaming.
        fileName - Name of the file that was uploaded.
        Throws:
        java.io.IOException
      • getFile

        @GET
        @Path("/{fileName}")
        public javax.ws.rs.core.Response getFile​(@PathParam("fileName")
                                                 java.lang.String fileName)
        Download file with streaming using a File object in the response. Streaming is automatically handled by MSF4J.
        Parameters:
        fileName - Name of the file to be downloaded.
        Returns:
        Response
      • getFileFromInputStream

        @GET
        @Path("/ip/{fileName}")
        public javax.ws.rs.core.Response getFileFromInputStream​(@PathParam("fileName")
                                                                java.lang.String fileName)
                                                         throws java.io.FileNotFoundException
        Download file with streaming using a InputStream object in the response. Streaming is automatically handled by MSF4J.
        Parameters:
        fileName - Name of the file to be downloaded.
        Returns:
        Response
        Throws:
        java.io.FileNotFoundException
      • getFileUsingStreamingOutput

        @GET
        @Path("/op/{fileName}")
        public javax.ws.rs.core.Response getFileUsingStreamingOutput​(@PathParam("fileName")
                                                                     java.lang.String fileName)
        Download file with Streaming using using StreamingOutput. You have more control over streaming chunk sizes when this method is used.
        Parameters:
        fileName - Name of the file to be downloaded.
        Returns:
        Response