Can someone provide me a demo of sending PDF files as feedback?
End point
@GET @ path ("/ PDF file") @WebMethod (OperationName = "PDF Files") Public Response PDF Files () {LOGGER.info ( "Getting FPodAUMFile."); Return dao.getPDFfiles (CacheKeys.pdffile); }
DAO will
public response getPDFfiles (string pdfile) {file file_pdf = new file ("D: / PDF file pdf"); // Send this PDFFILE.PDF to me and complete the code here}
The simple way MTOM is sent to it. Does anyone expand on using MTO?
You have to specify the content-break header in your response and write the file in the response unit. So for example:
public response getPDFfiles (string pdfile) {file file pdf = new file ("D: / PDF file pdf"); // You have to convert your file to a byte array. Content Disposal Content Disposion = New Material Disposition ("Attachment; Filename = PDF File PDF"); Returns Response.ok (New StreamingOptput () {@Override throws IOException in the public zero type (OutputStream OutputStream), WebApplicationException {outputstream.write (/ * content byte of your file [] * /);}}) .header ("content - Disposition ", contentDisposition.toString ()) .header (" content type "," application / pdf ") .build (); }
How to convert a file into byte [].
No comments:
Post a Comment