Package org.wso2.msf4j.example
Class FileServer
- java.lang.Object
-
- org.wso2.msf4j.example.FileServer
-
@Path("/") public class FileServer extends java.lang.ObjectFileServer 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.ResponsegetFile(java.lang.String fileName)Download file with streaming using aFileobject in the response.javax.ws.rs.core.ResponsegetFileFromInputStream(java.lang.String fileName)Download file with streaming using aInputStreamobject in the response.javax.ws.rs.core.ResponsegetFileUsingStreamingOutput(java.lang.String fileName)Download file with Streaming using usingStreamingOutput.voidpostFile(org.wso2.msf4j.HttpStreamer httpStreamer, java.lang.String fileName)Upload a file with streaming.
-
-
-
Method Detail
-
postFile
@POST @Path("/{fileName}") public void postFile(@Context org.wso2.msf4j.HttpStreamer httpStreamer, @PathParam("fileName") java.lang.String fileName) throws java.io.IOExceptionUpload a file with streaming.- Parameters:
httpStreamer- Handle for setting theHttpStreamHandlercallback 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 aFileobject 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.FileNotFoundExceptionDownload file with streaming using aInputStreamobject 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 usingStreamingOutput. You have more control over streaming chunk sizes when this method is used.- Parameters:
fileName- Name of the file to be downloaded.- Returns:
- Response
-
-