private static HttpHeaders convertResponse(Response coyoteRes) { final HttpHeaders headers = HttpHeaders.of(HttpStatus.valueOf(coyoteRes.getStatus())); final String contentType = coyoteRes.getContentType(); if (contentType != null && !contentType.isEmpty()) { headers.set(HttpHeaderNames.CONTENT_TYPE, contentType); } final long contentLength = coyoteRes.getBytesWritten(true); // 'true' will trigger flush. final String method = coyoteRes.getRequest().method().toString(); if (!"HEAD".equals(method)) { headers.setLong(HttpHeaderNames.CONTENT_LENGTH, contentLength); } final MimeHeaders cHeaders = coyoteRes.getMimeHeaders(); final int numHeaders = cHeaders.size(); for (int i = 0; i < numHeaders; i++) { final AsciiString name = toHeaderName(cHeaders.getName(i)); if (name == null) { continue; } final String value = toHeaderValue(cHeaders.getValue(i)); if (value == null) { continue; } headers.add(name.toLowerCase(), value); } return headers; }
/** * Return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return coyoteResponse.getBytesWritten(flush); }
/** * Return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return coyoteResponse.getBytesWritten(flush); }
public long getRequestBytesSent() { return req.getResponse().getBytesWritten(); }
public long getRequestBytesSent() { return req.getResponse().getBytesWritten(); }
public long getRequestBytesSent() { return req.getResponse().getBytesWritten(); }
/** * Return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return coyoteResponse.getBytesWritten(flush); }
/** * Return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return coyoteResponse.getBytesWritten(flush); }
/** * Return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return coyoteResponse.getBytesWritten(flush); }
/** * Return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return coyoteResponse.getBytesWritten(flush); }
/** * @return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. * @param flush if <code>true</code> will perform a buffer flush first */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return getCoyoteResponse().getBytesWritten(flush); }
/** * @return the number of bytes the actually written to the socket. This * includes chunking, compression, etc. but excludes headers. * @param flush if <code>true</code> will perform a buffer flush first */ public long getBytesWritten(boolean flush) { if (flush) { try { outputBuffer.flush(); } catch (IOException ioe) { // Ignore - the client has probably closed the connection } } return getCoyoteResponse().getBytesWritten(flush); }
/** Called by the processor before recycling the request. It'll collect * statistic information. */ void updateCounters() { bytesReceived+=req.getBytesRead(); bytesSent+=req.getResponse().getBytesWritten(); requestCount++; if( req.getResponse().getStatus() >=400 ) errorCount++; long t0=req.getStartTime(); long t1=System.currentTimeMillis(); long time=t1-t0; this.lastRequestProcessingTime = time; processingTime+=time; if( maxTime < time ) { maxTime=time; maxRequestUri=req.requestURI().toString(); } }
/** Called by the processor before recycling the request. It'll collect * statistic information. */ void updateCounters() { bytesReceived+=req.getBytesRead(); bytesSent+=req.getResponse().getBytesWritten(); requestCount++; if( req.getResponse().getStatus() >=400 ) errorCount++; long t0=req.getStartTime(); long t1=System.currentTimeMillis(); long time=t1-t0; this.lastRequestProcessingTime = time; processingTime+=time; if( maxTime < time ) { maxTime=time; maxRequestUri=req.requestURI().toString(); } }
/** Called by the processor before recycling the request. It'll collect * statistic information. */ void updateCounters() { bytesReceived+=req.getBytesRead(); bytesSent+=req.getResponse().getBytesWritten(); requestCount++; if( req.getResponse().getStatus() >=400 ) errorCount++; long t0=req.getStartTime(); long t1=System.currentTimeMillis(); long time=t1-t0; this.lastRequestProcessingTime = time; processingTime+=time; if( maxTime < time ) { maxTime=time; maxRequestUri=req.requestURI().toString(); } }