所以我现在正在渲染html到pdf文件每次运行代码文件下载并且工作正常但不是下载我想在文件生成后立即上传到ftp服务器上 以下是我的代码
@GET
@Path("/test")
public String test(@Context HttpServletResponse response){
String strHtml ="<html><body>"Here is my html"</body></html>";
String filename=test.pdf";
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
@SuppressWarnings( "deprecation")
org.w3c.dom.Document doc = builder.parse( new StringBufferInputStream(strHtml.replaceAll("&" , "&")));
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument((org.w3c.dom.Document) doc, null);
renderer.layout();
response.setHeader( "Cache-Control","private" );
response.setHeader( "Pragma","expires" );
response.setHeader( "Content-Disposition", "attachment; filename=\"" + filename + "\"");
renderer.createPDF(response.getOutputStream());
response.getOutputStream().flush();
response.getOutputStream().close();
}