本文整理了Java中org.eclipse.jetty.server.Response.getContentLength
方法的一些代码示例,展示了Response.getContentLength
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getContentLength
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Response
类名称:Response
方法名:getContentLength
暂无
代码示例来源:origin: neo4j/neo4j
@Override
public void log( Request request, Response response )
{
// Trying to replicate this logback pattern:
// %h %l %user [%t{dd/MMM/yyyy:HH:mm:ss Z}] "%r" %s %b "%i{Referer}" "%i{User-Agent}" %D
String remoteHost = swallowExceptions( request, HttpServletRequest::getRemoteHost );
String user = swallowExceptions( request, HttpServletRequest::getRemoteUser );
String requestURL = swallowExceptions( request, HttpServletRequest::getRequestURI ) + "?" +
swallowExceptions( request, HttpServletRequest::getQueryString );
int statusCode = response.getStatus();
long length = response.getContentLength();
String referer = swallowExceptions( request, r -> r.getHeader( "Referer" ) );
String userAgent = swallowExceptions( request, r -> r.getHeader( "User-Agent" ) );
long requestTimeStamp = request != null ? request.getTimeStamp() : -1;
long now = System.currentTimeMillis();
long serviceTime = requestTimeStamp < 0 ? -1 : now - requestTimeStamp;
log.info( "%s - %s [%tc] \"%s\" %s %s \"%s\" \"%s\" %s",
defaultString( remoteHost ),
defaultString( user ),
now,
defaultString( requestURL ),
statusCode,
length,
defaultString( referer ),
defaultString( userAgent ),
serviceTime );
}
代码示例来源:origin: stackoverflow.com
public class OkHttpDownloaderDiskCacheFirst extends OkHttpDownloader {
public OkHttpDownloaderDiskCacheFirst(OkHttpClient client) {
super(client);
}
@Override
public Response load(Uri uri, int networkPolicy) throws IOException {
Response responseDiskCache = null;
try {
responseDiskCache = super.load(uri, 1 << 2); //NetworkPolicy.OFFLINE
} catch (Exception ignored){} // ignore, handle null later
if (responseDiskCache == null || responseDiskCache.getContentLength()<=0){
return super.load(uri, networkPolicy); //user normal policy
} else {
return responseDiskCache;
}
}
}
代码示例来源:origin: org.neo4j.app/neo4j-server
@Override
public void log( Request request, Response response )
{
// Trying to replicate this logback pattern:
// %h %l %user [%t{dd/MMM/yyyy:HH:mm:ss Z}] "%r" %s %b "%i{Referer}" "%i{User-Agent}" %D
String remoteHost = swallowExceptions( request, HttpServletRequest::getRemoteHost );
String user = swallowExceptions( request, HttpServletRequest::getRemoteUser );
String requestURL = swallowExceptions( request, HttpServletRequest::getRequestURI ) + "?" +
swallowExceptions( request, HttpServletRequest::getQueryString );
int statusCode = response.getStatus();
long length = response.getContentLength();
String referer = swallowExceptions( request, r -> r.getHeader( "Referer" ) );
String userAgent = swallowExceptions( request, r -> r.getHeader( "User-Agent" ) );
long requestTimeStamp = request != null ? request.getTimeStamp() : -1;
long now = System.currentTimeMillis();
long serviceTime = requestTimeStamp < 0 ? -1 : now - requestTimeStamp;
log.info( "%s - %s [%tc] \"%s\" %s %s \"%s\" \"%s\" %s",
defaultString( remoteHost ),
defaultString( user ),
now,
defaultString( requestURL ),
statusCode,
length,
defaultString( referer ),
defaultString( userAgent ),
serviceTime );
}
代码示例来源:origin: com.nitorcreations/willow-logging-jetty
@Override
public void log(Request request, Response response) {
if (_ignorePathMap != null
&& _ignorePathMap.getMatch(request.getRequestURI()) != null)
return;
int status = response.getStatus();
long written = response.getContentLength();
transmitter.queue(new AccessLogJettyAdapter(request, status, written,
_preferProxiedForAddress));
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
fields.add(_vary);
long content_length = response.getContentLength();
if (content_length<0 && complete)
content_length=content.remaining();
代码示例来源:origin: jenkinsci/winstone
long content_length = response.getContentLength();
if (content_length<0 && complete)
content_length=content.remaining();
内容来源于网络,如有侵权,请联系作者删除!