List of usage examples for io.vertx.core.http HttpHeaders CONTENT_DISPOSITION
CharSequence CONTENT_DISPOSITION
To view the source code for io.vertx.core.http HttpHeaders CONTENT_DISPOSITION.
Click Source Link
From source file:org.apache.servicecomb.foundation.vertx.http.DownloadUtils.java
License:Apache License
public static void prepareDownloadHeader(HttpServletResponseEx responseEx, Part part) { if (responseEx.getHeader(HttpHeaders.CONTENT_LENGTH.toString()) == null) { responseEx.setChunked(true);/*from w w w. j a v a 2 s. com*/ } if (responseEx.getHeader(HttpHeaders.CONTENT_TYPE.toString()) == null) { responseEx.setHeader(HttpHeaders.CONTENT_TYPE.toString(), part.getContentType()); } if (responseEx.getHeader(javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION) == null) { // to support chinese and space filename in firefox // must use "filename*", (https://tools.ietf.org/html/rtf6266) String encodedFileName = HttpUtils.uriEncodePath(part.getSubmittedFileName()); responseEx.setHeader(javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + encodedFileName + ";filename*=utf-8''" + encodedFileName); } }