August 2018
Intermediate to advanced
314 pages
8h 9m
English
FileUploadResource is a resource class that uses JAX-RS to create a RESTful service to upload a file with JPG, PDF, and ZIP extensions. The following code contains the FileUploadResource resource class:
import javax.inject.Inject;import javax.ws.rs.Consumes;import javax.ws.rs.POST;import javax.ws.rs.Path;import javax.ws.rs.core.Response;import java.io.File;import java.io.IOException;@Path("upload")public class FileUploadResource { @Inject private PdfHandler pdfHandler; @Inject private JpgHandler jpgHandler; @Inject private ZipHandler zipHandler; @Consumes("application/pdf") @POST public Response uploadPdf(File file) throws IOException { FileBean fileBean = new FileBean(file, "pdf"); pdfHandler.handler( ...
Read now
Unlock full access