MessageBodyWriter not found for media type=application/pdf
07:29 01 Dec 2015

This does work with Jetty 9

@GET
@Path("pdf/file")
@Produces("application/pdf")
public Response getFile() {
    String fileName = Environment.getFilePath() + testFile;
    File file = Environment.getFile(fileName);

    Response response = Response.ok((Object) file).build();
    return response;
}

this

@GET
@Path("pdf/plain")
@Produces("application/pdf")
public Response getPlainPDF() {
    String formName = Environment.getFilePath() + testFile;
    PDDocument pdfDoc = PDF.getPDFDocument(formName);
    PDStream ps = new PDStream(pdfDoc);
    try {
        OutputStream outputStream = ps.createOutputStream();
        Response response = Response.ok((Object) outputStream).build();
        return response;
    } catch (IOException e) {
        System.out.println("Error creating PDF response " + e.getMessage());
        return null;
    }
}

fails with "MessageBodyWriter not found for media type=application/pdf". Would it be possible to programatically create a PDF with PDFBox and deliver it as PDF File without saving it first somewhere to disk ?

jetty pdfbox