Commit eccb0d84 by Patryk Czarnik

Content-Disposition

parent b6b5a89d
......@@ -32,6 +32,14 @@ public class PDFWriter implements MessageBodyWriter<Object> {
MultivaluedMap<String, Object> httpHeaders, OutputStream output)
throws IOException, WebApplicationException {
String fileName = "products.pdf";
if (obj instanceof Product) {
Product product = (Product) obj;
// fileName = product.getProductName().replace(' ', '_') + ".pdf";
fileName = String.format("product%04d.pdf", product.getProductId());
}
// httpHeaders.add("Content-Disposition", "attachment;filename=" + fileName);
httpHeaders.add("Content-Disposition", "inline;filename=" + fileName);
ObslugaXSL obslugaXSL = new ObslugaXSL(servletContext);
obslugaXSL.wypiszPDF(obj, output);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment