RequestInfo (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.coyote, class: RequestInfo

# Class RequestInfo

java.lang.Object
org.apache.coyote.RequestInfo

public class RequestInfo extends Object
Structure holding the Request and Response objects. It also holds statistical information about request processing and provide management information about the requests being processed. Each thread uses a Request/Response pair that is recycled on each request. This object provides a place to collect global low-level statistics - without having to deal with synchronization (since each thread will have its own RequestProcessorMX).

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RequestInfo(Request req)`
  Create a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getBytesReceived()`
  Return the total bytes received.
  `long`
  `getBytesSent()`
  Return the total bytes sent.
  `int`
  `getContentLength()`
  Return the content length.
  `String`
  `getCurrentQueryString()`
  Return the current query string.
  `String`
  `getCurrentUri()`
  Return the current request URI.
  `int`
  `getErrorCount()`
  Return the error count.
  `RequestGroupInfo`
  `getGlobalProcessor()`
  Return the global request processor.
  `long`
  `getLastRequestProcessingTime()`
  Return the processing time of the last request.
  `String`
  `getMaxRequestUri()`
  Return the URI of the request with the longest processing time.
  `long`
  `getMaxTime()`
  Return the maximum request processing time.
  `String`
  `getMethod()`
  Return the HTTP method.
  `String`
  `getPeerAddr()`
  Return the peer address.
  `long`
  `getProcessingTime()`
  Return the total processing time.
  `String`
  `getProtocol()`
  Return the protocol.
  `String`
  `getRemoteAddr()`
  Return the remote address.
  `String`
  `getRemoteAddrForwarded()`
  Obtain the remote address for this connection as reported by an intermediate proxy (if any).
  `long`
  `getRequestBytesReceived()`
  Return the bytes received for the current request.
  `long`
  `getRequestBytesSent()`
  Return the bytes sent for the current request.
  `int`
  `getRequestCount()`
  Return the request count.
  `long`
  `getRequestProcessingTime()`
  Return the processing time for the current request.
  `ObjectName`
  `getRpName()`
  Return the MBean name.
  `int`
  `getServerPort()`
  Return the server port.
  `int`
  `getStage()`
  Return the current processing stage.
  `String`
  `getVirtualHost()`
  Return the virtual host.
  `String`
  `getWorkerThreadName()`
  Return the worker thread name.
  `void`
  `recycleStatistcs()`
  Recycle all statistics.
  `void`
  `setBytesReceived(long bytesReceived)`
  Reset the bytes received.
  `void`
  `setBytesSent(long bytesSent)`
  Reset the bytes sent.
  `void`
  `setErrorCount(int errorCount)`
  Reset the error count.
  `void`
  `setGlobalProcessor(RequestGroupInfo global)`
  Set the global request processor.
  `void`
  `setLastRequestProcessingTime(long lastRequestProcessingTime)`
  Set the last request processing time.
  `void`
  `setMaxRequestUri(String maxRequestUri)`
  Set the maximum request URI.
  `void`
  `setMaxTime(long maxTime)`
  Reset the maximum time.
  `void`
  `setProcessingTime(long processingTime)`
  Reset the processing time.
  `void`
  `setRequestCount(int requestCount)`
  Reset the request count.
  `void`
  `setRpName(ObjectName rpName)`
  Set the MBean name.
  `void`
  `setStage(int stage)`
  Set the current processing stage.
  `void`
  `setWorkerThreadName(String workerThreadName)`
  Set the worker thread name.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RequestInfo

    public RequestInfo(Request req)
    Create a new instance.
    Parameters:
      `req` - the request

- ## Method Details

  - ### getGlobalProcessor

    public RequestGroupInfo getGlobalProcessor()
    Return the global request processor.
    Returns:
      the global processor

  - ### setGlobalProcessor

    public void setGlobalProcessor(RequestGroupInfo global)
    Set the global request processor.
    Parameters:
      `global` - the global processor

  - ### getMethod

    public String getMethod()
    Return the HTTP method.
    Returns:
      the HTTP method

  - ### getCurrentUri

    public String getCurrentUri()
    Return the current request URI.
    Returns:
      the current URI

  - ### getCurrentQueryString

    public String getCurrentQueryString()
    Return the current query string.
    Returns:
      the current query string

  - ### getProtocol

    public String getProtocol()
    Return the protocol.
    Returns:
      the protocol

  - ### getVirtualHost

    public String getVirtualHost()
    Return the virtual host.
    Returns:
      the virtual host

  - ### getServerPort

    public int getServerPort()
    Return the server port.
    Returns:
      the server port

  - ### getRemoteAddr

    public String getRemoteAddr()
    Return the remote address.
    Returns:
      the remote address

  - ### getPeerAddr

    public String getPeerAddr()
    Return the peer address.
    Returns:
      the peer address

  - ### getRemoteAddrForwarded

    public String getRemoteAddrForwarded()
    Obtain the remote address for this connection as reported by an intermediate proxy (if any).
    Returns:
      The remote address for this connection

  - ### getContentLength

    public int getContentLength()
    Return the content length.
    Returns:
      the content length

  - ### getRequestBytesReceived

    public long getRequestBytesReceived()
    Return the bytes received for the current request.
    Returns:
      the bytes received

  - ### getRequestBytesSent

    public long getRequestBytesSent()
    Return the bytes sent for the current request.
    Returns:
      the bytes sent

  - ### getRequestProcessingTime

    public long getRequestProcessingTime()
    Return the processing time for the current request.
    Returns:
      the processing time

  - ### getStage

    public int getStage()
    Return the current processing stage.
    Returns:
      the stage

  - ### setStage

    public void setStage(int stage)
    Set the current processing stage.
    Parameters:
      `stage` - the stage

  - ### getBytesSent

    public long getBytesSent()
    Return the total bytes sent.
    Returns:
      the bytes sent

  - ### setBytesSent

    public void setBytesSent(long bytesSent)
    Reset the bytes sent.
    Parameters:
      `bytesSent` - the new bytes sent

  - ### getBytesReceived

    public long getBytesReceived()
    Return the total bytes received.
    Returns:
      the bytes received

  - ### setBytesReceived

    public void setBytesReceived(long bytesReceived)
    Reset the bytes received.
    Parameters:
      `bytesReceived` - the new bytes received

  - ### getProcessingTime

    public long getProcessingTime()
    Return the total processing time.
    Returns:
      the processing time

  - ### setProcessingTime

    public void setProcessingTime(long processingTime)
    Reset the processing time.
    Parameters:
      `processingTime` - the new processing time

  - ### getMaxTime

    public long getMaxTime()
    Return the maximum request processing time.
    Returns:
      the maximum time

  - ### setMaxTime

    public void setMaxTime(long maxTime)
    Reset the maximum time.
    Parameters:
      `maxTime` - the new maximum time

  - ### getMaxRequestUri

    public String getMaxRequestUri()
    Return the URI of the request with the longest processing time.
    Returns:
      the maximum request URI

  - ### setMaxRequestUri

    public void setMaxRequestUri(String maxRequestUri)
    Set the maximum request URI.
    Parameters:
      `maxRequestUri` - the maximum request URI

  - ### getRequestCount

    public int getRequestCount()
    Return the request count.
    Returns:
      the request count

  - ### setRequestCount

    public void setRequestCount(int requestCount)
    Reset the request count.
    Parameters:
      `requestCount` - the new request count

  - ### getErrorCount

    public int getErrorCount()
    Return the error count.
    Returns:
      the error count

  - ### setErrorCount

    public void setErrorCount(int errorCount)
    Reset the error count.
    Parameters:
      `errorCount` - the new error count

  - ### getWorkerThreadName

    public String getWorkerThreadName()
    Return the worker thread name.
    Returns:
      the worker thread name

  - ### getRpName

    public ObjectName getRpName()
    Return the MBean name.
    Returns:
      the MBean name

  - ### getLastRequestProcessingTime

    public long getLastRequestProcessingTime()
    Return the processing time of the last request.
    Returns:
      the last request processing time

  - ### setWorkerThreadName

    public void setWorkerThreadName(String workerThreadName)
    Set the worker thread name.
    Parameters:
      `workerThreadName` - the worker thread name

  - ### setRpName

    public void setRpName(ObjectName rpName)
    Set the MBean name.
    Parameters:
      `rpName` - the MBean name

  - ### setLastRequestProcessingTime

    public void setLastRequestProcessingTime(long lastRequestProcessingTime)
    Set the last request processing time.
    Parameters:
      `lastRequestProcessingTime` - the last request processing time

  - ### recycleStatistcs

    public void recycleStatistcs()
    Recycle all statistics.