本文整理了Java中org.apache.coyote.Response.setContentLength
方法的一些代码示例,展示了Response.setContentLength
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.setContentLength
方法的具体详情如下:
包路径:org.apache.coyote.Response
类名称:Response
方法名:setContentLength
暂无
代码示例来源:origin: org.jboss.web/jbossweb
public void setContentLengthLong(long length) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
if (usingWriter)
return;
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* TODO SERVLET 3.1
*/
@Override
public void setContentLengthLong(long length) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: tomcat/catalina
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
public void setContentLength(int length) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
if (usingWriter)
return;
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib
/* */ public void setContentLength(int length)
/* */ {
/* 700 */ if (isCommitted()) {
/* 701 */ return;
/* */ }
/* */
/* 704 */ if (this.included) {
/* 705 */ return;
/* */ }
/* 707 */ if (this.usingWriter) {
/* 708 */ return;
/* */ }
/* 710 */ this.coyoteResponse.setContentLength(length);
/* */ }
/* */
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
@Override
public void setContentLength(int length) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
@Override
public void setContentLength(int length) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
if (usingWriter)
return;
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: org.jboss.web/jbossweb
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
public void setContentLength(int length) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
if (usingWriter)
return;
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: jboss.web/jbossweb
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
public void setContentLength(int length) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
if (usingWriter)
return;
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
@Override
public void setContentLength(int length) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
@Override
public void setContentLength(int length) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
if (usingWriter)
return;
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/**
* Set the content length (in bytes) for this Response.
*
* @param length The new content length
*/
@Override
public void setContentLength(int length) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
if (usingWriter)
return;
coyoteResponse.setContentLength(length);
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Set internal fields for special header names.
* Called from set/addHeader.
* Return true if the header is special, no need to set the header.
*/
private boolean checkSpecialHeader( String name, String value) {
// XXX Eliminate redundant fields !!!
// ( both header and in special fields )
if( name.equalsIgnoreCase( "Content-Type" ) ) {
setContentType( value );
return true;
}
if( name.equalsIgnoreCase( "Content-Length" ) ) {
try {
long cL=Long.parseLong( value );
setContentLength( cL );
return true;
} catch( NumberFormatException ex ) {
// Do nothing - the spec doesn't have any "throws"
// and the user might know what he's doing
return false;
}
}
return false;
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* Set internal fields for special header names.
* Called from set/addHeader.
* Return true if the header is special, no need to set the header.
*/
private boolean checkSpecialHeader( String name, String value) {
// XXX Eliminate redundant fields !!!
// ( both header and in special fields )
if( name.equalsIgnoreCase( "Content-Type" ) ) {
setContentType( value );
return true;
}
if( name.equalsIgnoreCase( "Content-Length" ) ) {
try {
long cL=Long.parseLong( value );
setContentLength( cL );
return true;
} catch( NumberFormatException ex ) {
// Do nothing - the spec doesn't have any "throws"
// and the user might know what he's doing
return false;
}
}
return false;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public void setContentLengthLong(long length) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
getCoyoteResponse().setContentLength(length);
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@Override
public void setContentLengthLong(long length) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
getCoyoteResponse().setContentLength(length);
}
代码示例来源:origin: org.picketlink.distribution/picketlink-jbas7
/**
* <p> Before forwarding we need to know the content length of the target resource in order to configure the response properly.
* This is necessary because the valve already have written to the response, and we want to override with the target resource
* data. </p>
*
* @param request
* @param response
* @param dispatch
*
* @throws ServletException
* @throws IOException
*/
private void includeResource(ServletRequest request, Response response, RequestDispatcher dispatch)
throws ServletException, IOException {
dispatch.include(request, response);
// we need to re-configure the content length because Tomcat will truncate the output with the size of the welcome page
// (eg.: index.html).
response.getCoyoteResponse().setContentLength(response.getContentCount());
}
代码示例来源:origin: org.picketlink/picketlink-tomcat-common
/**
* <p> Before forwarding we need to know the content length of the target resource in order to configure the response properly.
* This is necessary because the valve already have written to the response, and we want to override with the target resource
* data. </p>
*
* @param request
* @param response
* @param dispatch
*
* @throws ServletException
* @throws IOException
*/
private void includeResource(ServletRequest request, Response response, RequestDispatcher dispatch)
throws ServletException, IOException {
dispatch.include(request, response);
// we need to re-configure the content length because Tomcat will truncate the output with the size of the welcome page
// (eg.: index.html).
response.getCoyoteResponse().setContentLength(response.getContentCount());
}
代码示例来源:origin: org.picketlink.distribution/picketlink-jbas5
/**
* <p> Before forwarding we need to know the content length of the target resource in order to configure the response properly.
* This is necessary because the valve already have written to the response, and we want to override with the target resource
* data. </p>
*
* @param request
* @param response
* @param dispatch
*
* @throws ServletException
* @throws IOException
*/
private void includeResource(ServletRequest request, Response response, RequestDispatcher dispatch)
throws ServletException, IOException {
dispatch.include(request, response);
// we need to re-configure the content length because Tomcat will truncate the output with the size of the welcome page
// (eg.: index.html).
response.getCoyoteResponse().setContentLength(response.getContentCount());
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* Close the output buffer. This tries to calculate the response size if
* the response has not been committed yet.
*
* @throws IOException An underlying IOException occurred
*/
@Override
public void close()
throws IOException {
if (closed)
return;
if (suspended)
return;
if ((!coyoteResponse.isCommitted())
&& (coyoteResponse.getContentLengthLong() == -1)) {
// If this didn't cause a commit of the response, the final content
// length can be calculated
if (!coyoteResponse.isCommitted()) {
coyoteResponse.setContentLength(bb.getLength());
}
}
doFlush(false);
closed = true;
coyoteResponse.finish();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
/**
* Close the output buffer. This tries to calculate the response size if
* the response has not been committed yet.
*
* @throws IOException An underlying IOException occurred
*/
@Override
public void close()
throws IOException {
if (closed)
return;
if (suspended)
return;
if ((!coyoteResponse.isCommitted())
&& (coyoteResponse.getContentLengthLong() == -1)) {
// If this didn't cause a commit of the response, the final content
// length can be calculated
if (!coyoteResponse.isCommitted()) {
coyoteResponse.setContentLength(bb.getLength());
}
}
doFlush(false);
closed = true;
coyoteResponse.finish();
}
内容来源于网络,如有侵权,请联系作者删除!