本文整理了Java中jodd.http.HttpResponse.contentEncoding()
方法的一些代码示例,展示了HttpResponse.contentEncoding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.contentEncoding()
方法的具体详情如下:
包路径:jodd.http.HttpResponse
类名称:HttpResponse
方法名:contentEncoding
暂无
代码示例来源:origin: oblac/jodd
/**
* Unzips GZip-ed body content, removes the content-encoding header
* and sets the new content-length value.
*/
public HttpResponse unzip() {
String contentEncoding = contentEncoding();
if (contentEncoding != null && contentEncoding().equals("gzip")) {
if (body != null) {
headerRemove(HEADER_CONTENT_ENCODING);
try {
ByteArrayInputStream in = new ByteArrayInputStream(body.getBytes(StringPool.ISO_8859_1));
GZIPInputStream gzipInputStream = new GZIPInputStream(in);
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamUtil.copy(gzipInputStream, out);
body(out.toString(StringPool.ISO_8859_1));
} catch (IOException ioex) {
throw new HttpException(ioex);
}
}
}
return this;
}
代码示例来源:origin: org.jodd/jodd-http
/**
* Unzips GZip-ed body content, removes the content-encoding header
* and sets the new content-length value.
*/
public HttpResponse unzip() {
String contentEncoding = contentEncoding();
if (contentEncoding != null && contentEncoding().equals("gzip")) {
if (body != null) {
headerRemove(HEADER_CONTENT_ENCODING);
try {
ByteArrayInputStream in = new ByteArrayInputStream(body.getBytes(StringPool.ISO_8859_1));
GZIPInputStream gzipInputStream = new GZIPInputStream(in);
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamUtil.copy(gzipInputStream, out);
body(out.toString(StringPool.ISO_8859_1));
} catch (IOException ioex) {
throw new HttpException(ioex);
}
}
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!