org.eclipse.jetty.server.Request.getTimeStamp()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(288)

本文整理了Java中org.eclipse.jetty.server.Request.getTimeStamp方法的一些代码示例,展示了Request.getTimeStamp的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getTimeStamp方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getTimeStamp

Request.getTimeStamp介绍

[英]Get Request TimeStamp
[中]获取请求时间戳

代码示例

代码示例来源: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: org.eclipse.jetty/jetty-security

public String newNonce(Request request)
{
  Nonce nonce;
  do
  {
    byte[] nounce = new byte[24];
    _random.nextBytes(nounce);
    nonce = new Nonce(new String(B64Code.encode(nounce)), request.getTimeStamp(), getMaxNonceCount());
  }
  while (_nonceMap.putIfAbsent(nonce._nonce, nonce) != null);
  _nonceQueue.add(nonce);
  return nonce._nonce;
}

代码示例来源:origin: org.eclipse.jetty/jetty-security

long expired = request.getTimeStamp() - getMaxNonceAge();
Nonce nonce = _nonceQueue.peek();
while (nonce != null && nonce._ts < expired)

代码示例来源:origin: i2p/i2p.i2p

buf.append(" [");
if (_logDateCache!=null)
  buf.append(_logDateCache.format(request.getTimeStamp()));
else
  buf.append(request.getTimeStamp());
    _writer.write(Long.toString(System.currentTimeMillis() - request.getTimeStamp()));

代码示例来源:origin: ch.qos.logback/logback-access

@Override
public long getRequestTimestamp() {
  return request.getTimeStamp();
}

代码示例来源:origin: stackoverflow.com

class SortRequest implements Comparator<Request>{
  public int compare(Request r1, Request r2) {
   if(r1.getTimeStamp()!=r2.getTimeStamp())
     return new Integer(r1.getTimeStamp()).compareTo(r2.getTimeStamp());
   if(r1.getSiteId()!=r2.getSiteId())
     return new Integer(r1.getSiteId()).compareTo(r2.getSiteId());
   return 0;      
  }
}

代码示例来源:origin: stackoverflow.com

public int compare(Request r1, Request r2) {
  int diff = Integer.compare(r1.getTimeStamp(), r2.getTimeStamp());

  if (diff != 0)
    return diff;

  return Integer.compare(r1.siteId(), r2.siteId());
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public String newNonce(Request request)
{
  Nonce nonce;
  
  do
  {
    byte[] nounce = new byte[24];
    _random.nextBytes(nounce);
    nonce = new Nonce(new String(B64Code.encode(nounce)),request.getTimeStamp(),_maxNC);
  }
  while (_nonceMap.putIfAbsent(nonce._nonce,nonce)!=null);
  _nonceQueue.add(nonce);
        return nonce._nonce;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

public String newNonce(Request request)
{
  Nonce nonce;
  
  do
  {
    byte[] nounce = new byte[24];
    _random.nextBytes(nounce);
    nonce = new Nonce(new String(B64Code.encode(nounce)),request.getTimeStamp(),_maxNC);
  }
  while (_nonceMap.putIfAbsent(nonce._nonce,nonce)!=null);
  _nonceQueue.add(nonce);
        return nonce._nonce;
}

代码示例来源:origin: com.teradata.airlift/http-server

@Override
  public void log(Request request, Response response)
  {
    Duration requestTime = new Duration(max(0, System.currentTimeMillis() - request.getTimeStamp()), TimeUnit.MILLISECONDS);

    long dispatchTime = request.getTimeStamp();

    Duration schedulingDelay = new Duration(max(0, dispatchTime - request.getTimeStamp()), TimeUnit.MILLISECONDS);

    stats.record(request.getMethod(), response.getStatus(), request.getContentRead(), response.getContentCount(), schedulingDelay, requestTime);
  }
}

代码示例来源:origin: io.airlift/http-server

@Override
  public void log(Request request, Response response)
  {
    Duration requestTime = new Duration(max(0, System.currentTimeMillis() - request.getTimeStamp()), TimeUnit.MILLISECONDS);
    stats.record(request.getContentRead(), response.getContentCount(), requestTime);
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public void onComplete(Continuation continuation)
{
  final Request request = ((AsyncContinuation)continuation).getBaseRequest();
  final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
  
  _requestStats.decrement();
  _requestTimeStats.set(elapsed);
  
  updateResponse(request);
  
  if (!continuation.isResumed())
    _suspendStats.decrement();
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

public void onComplete(Continuation continuation)
{
  final Request request = ((AsyncContinuation)continuation).getBaseRequest();
  final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
  
  _requestStats.decrement();
  _requestTimeStats.set(elapsed);
  
  updateResponse(request);
  
  if (!continuation.isResumed())
    _suspendStats.decrement();
}

代码示例来源:origin: org.eclipse.jetty/server

public void onComplete(Continuation continuation)
{
  final Request request = ((AsyncContinuation)continuation).getBaseRequest();
  final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
  
  _requestStats.decrement();
  _requestTimeStats.set(elapsed);
  
  updateResponse(request);
  
  if (!continuation.isResumed())
    _suspendStats.decrement();
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

public void onComplete(Continuation continuation)
{
  final Request request = ((AsyncContinuation)continuation).getBaseRequest();
  final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
  
  _requestStats.decrement();
  _requestTimeStats.set(elapsed);
  
  updateResponse(request);
  
  if (!continuation.isResumed())
    _suspendStats.decrement();
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

public void onComplete(Continuation continuation)
{
  final Request request = ((AsyncContinuation)continuation).getBaseRequest();
  final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
  
  _requestStats.decrement();
  _requestTimeStats.set(elapsed);
  
  updateResponse(request);
  
  if (!continuation.isResumed())
    _suspendStats.decrement();
}

代码示例来源:origin: Kixeye/chassis

private void updateResponses(Request request) {
    final int response = request.getResponse().getStatus() / 100;
    if (response >= 1 && response <= 5) {
      responses[response - 1].mark();
    }
    activeRequests.dec();
    final long elapsedTime = System.currentTimeMillis() - request.getTimeStamp();
    requests.update(elapsedTime, TimeUnit.MILLISECONDS);
    requestTimer(request.getMethod()).update(elapsedTime, TimeUnit.MILLISECONDS);
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
public void onComplete(AsyncEvent event) throws IOException
{
  HttpChannelState state = (HttpChannelState)event.getAsyncContext();
  
  Request request = state.getBaseRequest();
  final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
  _requestStats.decrement();
  _requestTimeStats.set(elapsed);
  updateResponse(request);
  if (!state.isDispatched())
    _asyncWaitStats.decrement();
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
public void onComplete(AsyncEvent event) throws IOException
{
  HttpChannelState state = (HttpChannelState)event.getAsyncContext();
  
  Request request = state.getBaseRequest();
  final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
  _requestStats.decrement();
  _requestTimeStats.set(elapsed);
  updateResponse(request);
  if (!state.isDispatched())
    _asyncWaitStats.decrement();
}

代码示例来源:origin: com.proofpoint.platform/http-server

@Override
  public void log(Request request, Response response)
  {
    Duration requestTime = new Duration(max(0, System.currentTimeMillis() - request.getTimeStamp()), TimeUnit.MILLISECONDS);
    SSLSession sslSession = (SSLSession) request.getAttribute(REQUEST_SSL_SESSION_ATTRIBUTE);

    stats.record(request.getContentRead(), response.getContentCount(), requestTime);
    detailedRequestStats.requestTimeByCode(response.getStatus(), response.getStatus() / 100).add(requestTime);

    if (sslSession != null) {
      detailedRequestStats.tlsRequest(sslSession.getProtocol(), sslSession.getCipherSuite()).add(1);
    }
  }
}

相关文章

Request类方法