org.apache.catalina.connector.Response.getBytesWritten()方法的使用及代码示例

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

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

Response.getBytesWritten介绍

[英]Return the number of bytes the actually written to the socket. This includes chunking, compression, etc. but excludes headers.
[中]返回实际写入套接字的字节数。这包括分块、压缩等,但不包括标题。

代码示例

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

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(length);
    }
  }
}

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

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(length);
    }
  }
}

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

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(length);
    }
  }
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0) {
      // Protect against nulls and unexpected types as these values
      // may be set by untrusted applications
      Object start = request.getAttribute(
          "org.apache.tomcat.sendfile.start");
      if (start instanceof Long) {
        Object end = request.getAttribute(
            "org.apache.tomcat.sendfile.end");
        if (end instanceof Long) {
          length = ((Long) end).longValue() -
              ((Long) start).longValue();
        }
      }
    }
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(length);
    }
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0) {
      // Protect against nulls and unexpected types as these values
      // may be set by untrusted applications
      Object start = request.getAttribute(
          Globals.SENDFILE_FILE_START_ATTR);
      if (start instanceof Long) {
        Object end = request.getAttribute(
            Globals.SENDFILE_FILE_END_ATTR);
        if (end instanceof Long) {
          length = ((Long) end).longValue() -
              ((Long) start).longValue();
        }
      }
    }
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(length);
    }
  }
}

代码示例来源:origin: net.rakugakibox.springbootext/spring-boot-ext-logback-access

/** {@inheritDoc} */
@Override
public long getContentLength() {
  long length = response.getBytesWritten(false);
  if (length <= 0) {
    Object start = request.getAttribute(Globals.SENDFILE_FILE_START_ATTR);
    Object end = request.getAttribute(Globals.SENDFILE_FILE_END_ATTR);
    if (start instanceof Long && end instanceof Long) {
      Long startAsLong = (Long) start;
      Long endAsLong = (Long) end;
      length = endAsLong - startAsLong;
    }
  }
  return length;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
  public void addElement(CharArrayWriter buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0) {
      // Protect against nulls and unexpected types as these values
      // may be set by untrusted applications
      Object start = request.getAttribute(
          Globals.SENDFILE_FILE_START_ATTR);
      if (start instanceof Long) {
        Object end = request.getAttribute(
            Globals.SENDFILE_FILE_END_ATTR);
        if (end instanceof Long) {
          length = ((Long) end).longValue() -
              ((Long) start).longValue();
        }
      }
    }
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(Long.toString(length));
    }
  }
}

代码示例来源:origin: net.rakugakibox.spring.boot/logback-access-spring-boot-starter

/** {@inheritDoc} */
@Override
public long getContentLength() {
  long length = response.getBytesWritten(false);
  if (length > 0) {
    return length;
  }
  Long start = (Long) request.getAttribute(Globals.SENDFILE_FILE_START_ATTR);
  Long end = (Long) request.getAttribute(Globals.SENDFILE_FILE_END_ATTR);
  if (start != null && end != null) {
    return end - start;
  }
  return super.getContentLength();
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
  public void addElement(CharArrayWriter buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0) {
      // Protect against nulls and unexpected types as these values
      // may be set by untrusted applications
      Object start = request.getAttribute(
          Globals.SENDFILE_FILE_START_ATTR);
      if (start instanceof Long) {
        Object end = request.getAttribute(
            Globals.SENDFILE_FILE_END_ATTR);
        if (end instanceof Long) {
          length = ((Long) end).longValue() -
              ((Long) start).longValue();
        }
      }
    }
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(Long.toString(length));
    }
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
  public void addElement(CharArrayWriter buf, Date date, Request request,
      Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0) {
      // Protect against nulls and unexpected types as these values
      // may be set by untrusted applications
      Object start = request.getAttribute(
          Globals.SENDFILE_FILE_START_ATTR);
      if (start instanceof Long) {
        Object end = request.getAttribute(
            Globals.SENDFILE_FILE_END_ATTR);
        if (end instanceof Long) {
          length = ((Long) end).longValue() -
              ((Long) start).longValue();
        }
      }
    }
    if (length <= 0 && conversion) {
      buf.append('-');
    } else {
      buf.append(Long.toString(length));
    }
  }
}

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

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0)
  bytes = 0;

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

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0)
  bytes = 0;

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

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0)
  bytes = 0;

代码示例来源:origin: codefollower/Tomcat-Research

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0) {
  bytes = 0;

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0) {
  bytes = 0;

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0) {
  bytes = 0;

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0) {
  bytes = 0;

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

String query=request.getRequestURI();
long bytes = response.getBytesWritten(true);
if(bytes < 0) {
  bytes = 0;

相关文章

Response类方法