com.atlassian.bitbucket.request.RequestContext |
Provides information about a request, such as the requestId, sessionId, remoteAddress and more. RequestContext
is currently used as an abstraction for HTTP and SSH requests, but can easily be used for other protocols as well.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers a cleanup task that is executed when the current request ends.
| |||||||||||
Adds a label to the request context that will be included in the access logs.
| |||||||||||
Returns a highly unique (though not guaranteeably unique) request ID.
| |||||||||||
Report on the number of bytes read for this request.
| |||||||||||
Report on the number of bytes written for this request.
| |||||||||||
The response code of the request.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.atlassian.bitbucket.request.RequestInfoProvider
| |||||||||||
From interface
com.atlassian.bitbucket.request.RequestMetadata
|
Registers a cleanup task that is executed when the current request ends. Note that the callback will only be called for the current request.
callback | callback that should be called when the request ends |
---|
IllegalStateException | if no request is active
|
---|
Adds a label to the request context that will be included in the access logs. Use this purely for diagnostic / analysis purposes.
label | the label to add |
---|
IllegalStateException | if no request is active
|
---|
Returns a highly unique (though not guaranteeably unique) request ID.
The request ID contains:
long
for the counter wraps (which at 1,000 requests per second will take 252 million years).
It is worth noting that the uniqueness period required for request IDs is 1 day, which is the period at which log files are rotated. The goal of this ID is not to be universally unique so much as it is to allow support to easily trace the logging related to a single request, within the log files.
IllegalStateException | if no request is active
|
---|
true
if the request is in progress. false
if there is no current request or the request
has finished
Report on the number of bytes read for this request.
bytesRead | the number of bytes read |
---|
IllegalStateException | if no request is active
|
---|
Report on the number of bytes written for this request.
bytesWritten | the number of bytes written |
---|
IllegalStateException | if no request is active
|
---|
The response code of the request. HTTP(S) requests the HTTP response code is used. SSH requests the exit code of the git process is used.
responseCode | the request response code |
---|
IllegalStateException | if no request is active
|
---|