本文整理了Java中org.glassfish.grizzly.http.server.Response.setContentLengthLong
方法的一些代码示例,展示了Response.setContentLengthLong
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.setContentLengthLong
方法的具体详情如下:
包路径:org.glassfish.grizzly.http.server.Response
类名称:Response
方法名:setContentLengthLong
[英]Set the content length (in bytes) for this Response. If the length
argument is negative - then org.glassfish.grizzly.http.HttpPacketcontent-length value will be reset to -1 and Content-Length header (if present) will be removed.
[中]设置此响应的内容长度(字节)。如果length
参数为负,则为org。玻璃鱼。灰熊http。HttpPacketcontent-length值将重置为-1,内容长度标题(如果存在)将被删除。
代码示例来源:origin: jersey/jersey
@Override
public OutputStream writeResponseStatusAndHeaders(final long contentLength,
final ContainerResponse context)
throws ContainerException {
try {
final javax.ws.rs.core.Response.StatusType statusInfo = context.getStatusInfo();
if (statusInfo.getReasonPhrase() == null) {
grizzlyResponse.setStatus(statusInfo.getStatusCode());
} else {
grizzlyResponse.setStatus(statusInfo.getStatusCode(), statusInfo.getReasonPhrase());
}
grizzlyResponse.setContentLengthLong(contentLength);
for (final Map.Entry<String, List<String>> e : context.getStringHeaders().entrySet()) {
for (final String value : e.getValue()) {
grizzlyResponse.addHeader(e.getKey(), value);
}
}
return grizzlyResponse.getOutputStream();
} finally {
logger.debugLog("{0} - writeResponseStatusAndHeaders() called", name);
}
}
代码示例来源:origin: javaee/grizzly
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: javaee/grizzly
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: javaee/grizzly
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-http-server
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: javaee/grizzly
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: javaee/grizzly
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: javaee/grizzly
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: javaee/grizzly
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
/**
* Set the content length (in bytes) for this Response.
*
* If the <code>length</code> argument is negative - then {@link org.glassfish.grizzly.http.HttpPacket}
* content-length value will be reset to <tt>-1</tt> and
* <tt>Content-Length</tt> header (if present) will be removed.
*
* @param length The new content length
*/
public void setContentLength(final int length) {
setContentLengthLong(length);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/**
* {@inheritDoc}
*/
@Override
public void setContentLengthLong(long len) {
if (isCommitted())
return;
response.setContentLengthLong(len);
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public void setContentLengthLong(long len) {
if (isCommitted())
return;
response.setContentLengthLong(len);
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public void setContentLengthLong(long len) {
if (isCommitted())
return;
response.setContentLengthLong(len);
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public void setContentLengthLong(long len) {
if (isCommitted())
return;
response.setContentLengthLong(len);
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public void setContentLengthLong(long len) {
if (isCommitted())
return;
response.setContentLengthLong(len);
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public void setContentLengthLong(long len) {
if (isCommitted())
return;
response.setContentLengthLong(len);
}
代码示例来源:origin: javaee/grizzly
public static void sendFile(final Response response, final File file)
throws IOException {
response.setStatus(HttpStatus.OK_200);
// In case this sendFile(...) is called directly by user - pickup the content-type
pickupContentType(response, file.getPath());
final long length = file.length();
response.setContentLengthLong(length);
response.addDateHeader(Header.Date, System.currentTimeMillis());
if (!response.isSendFileEnabled() || response.getRequest().isSecure()) {
sendUsingBuffers(response, file);
} else {
sendZeroCopy(response, file);
}
}
代码示例来源:origin: javaee/grizzly
public static void sendFile(final Response response, final File file)
throws IOException {
response.setStatus(HttpStatus.OK_200);
// In case this sendFile(...) is called directly by user - pickup the content-type
pickupContentType(response, file.getPath());
final long length = file.length();
response.setContentLengthLong(length);
response.addDateHeader(Header.Date, System.currentTimeMillis());
if (!response.isSendFileEnabled() || response.getRequest().isSecure()) {
sendUsingBuffers(response, file);
} else {
sendZeroCopy(response, file);
}
}
内容来源于网络,如有侵权,请联系作者删除!