Class RequestContext
java.lang.Object
org.forgerock.opendj.server.core.RequestContext
Contextual state associated with the processing of an LDAP client request.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRequestContextbuilder.static enumDistinguishes operations from server components, not directly from LDAP clients. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds aAdditionalLogItemto the list for logging.voidaddCancelRequestListener(Consumer<CancelledResultException> onCancelRequest) Registers the provided cancellation listener with this request context so that it can be notified if a cancellation request is received and processing of the request should be aborted if possible.static RequestContext.Builderbuilder(ClientConnection connection) Returns a newRequestContextbuilder with the provided parent context and connection.voidcannotCancel(LocalizableMessage cannotCancelReason) Indicates that the request associated with this request context cannot be cancelled.voidcheckIfCancelled(boolean signalTooLate) ThrowsCancelledResultExceptionif a cancellation request has been received and processing of the request should be aborted if possible.Returns additional information to be logged, as a potentially emptyListofAdditionalLogItem.Returns the authentication Dn for logging.Returns the authorization Dn for logging, which could be from proxy auth.Returns the client connection associated with this request.longReturns the elapsed processing time for the request.longReturns the elapsed queueing time for the request.Returns the time unit that is used for reporting elapsed times of the request.longReturns the elapsed total time for the request.Returns the entry as added by the server, with all additional operational attributes.Returns the JFR request event associated with this request.longReturns the size of the largest entry targeted by the request.Retrieves the real, masked error message for this operation.Retrieves the real, masked result code for this operation.intReturns the message id associated to the request.Returns the list of modifications applied by the server.longReturns the operation id associated to the request.longReturns the time since the epoch when processing the request completed.Returns the proxied authorization DN if proxy authorization has been requested.longReturns the time since the epoch when the request was received.intReturns the number of entries sent by the search request associated to this context.getThreadNameForRequest(Request request) Returns the name that should be used for processing a request.longReturns the accumulated entries size.org.forgerock.services.TransactionIdReturns the transaction ID.booleanhasFlag(RequestContext.RequestFlag requestFlag) Returns whether this request has the provided flag.booleanhasPrivilege(Privilege privilege) Returnstrueif the authorized user has the specified privilege.voidIncrements the number of entries returned by the search request associated to this context.Returns the matched naming context.voidSignals that this request has completed processing.voidSignals that this request is no long queuing and is about to be processed.voidrecordEntrySize(long size) Update the entry size statisticstotalEntriesSizeandlargestEntrySizeof the entries that have been accessed by the request.voidSets theAdditionalLogItems.voidsetEntryAsAddedByServer(Entry entryAsAddedByServer) Sets the entry added as added by the server in the DIT.voidsetFlag(RequestContext.RequestFlag requestFlag) Sets the provided flag for this request.voidsetMaskedErrorMessage(LocalizableMessage maskedErrorMessage) Sets the masked error message.voidsetMaskedResultCode(ResultCode maskedResultCode) Specifies the real, masked result code for this operation.voidsetMatchedNamingContext(Dn matchedNamingContext) Sets the matched naming context.voidsetModificationsAsAppliedByServer(List<Modification> modificationsAsAppliedByServer) Sets the list of modifications applied to an entry by the server while processing a Modify request.voidsetProxiedAuthorizationDn(Dn proxiedAuthorizationDn) Set the proxied authorization DN for this operation if any.
-
Method Details
-
builder
Returns a newRequestContextbuilder with the provided parent context and connection.- Parameters:
connection- The client connection associated with this request.- Returns:
- The builder.
-
getTransactionId
public org.forgerock.services.TransactionId getTransactionId()Returns the transaction ID.- Returns:
- the non-
nulltransaction ID.
-
getAuthenticationDn
-
getAuthorizationDn
Returns the authorization Dn for logging, which could be from proxy auth.- Returns:
- a
DnorDn#emptyDn()if there is nothing to log.
-
getEntryAsAddedByServer
Returns the entry as added by the server, with all additional operational attributes.May differ from the entry specified in the Add request as attributes may be encoded, audit log will preferentially use the server entry.
- Returns:
- the entry as added by the server, with all additional operational attributes
-
setEntryAsAddedByServer
Sets the entry added as added by the server in the DIT.- Parameters:
entryAsAddedByServer- the entry added by the server
-
getModificationsAsAppliedByServer
Returns the list of modifications applied by the server.May differ from client specified modifications as some attributes may be encoded, audit log will preferentially use the returned list.
- Returns:
- the list of modifications applied by the server
-
setModificationsAsAppliedByServer
Sets the list of modifications applied to an entry by the server while processing a Modify request.- Parameters:
modificationsAsAppliedByServer- the list of modifications generated by the server
-
addCancelRequestListener
Registers the provided cancellation listener with this request context so that it can be notified if a cancellation request is received and processing of the request should be aborted if possible. Requests may be cancelled as a result of an abandon request or a cancel extended request sent from the client, or by the server itself (e.g. during server shutdown).- Parameters:
onCancelRequest- The listener which should be notified if processing of the request should be aborted. Implementations should, if possible, abort further processing of the request and return an appropriate cancellation result.- See Also:
-
checkIfCancelled
ThrowsCancelledResultExceptionif a cancellation request has been received and processing of the request should be aborted if possible. Requests may be cancelled as a result of an abandon request or a cancel extended request sent from the client, or by the server itself (e.g. during server shutdown).- Parameters:
signalTooLate-trueto signal that, after this method returns, processing of the request will have proceeded too far for it to be aborted by subsequent cancellation requests.- Throws:
CancelledResultException- If processing of the request should be aborted if possible.- See Also:
-
cannotCancel
Indicates that the request associated with this request context cannot be cancelled. Any cancellation requests will be rejected with aResultCode.CANNOT_CANCELand the provided reason.- Parameters:
cannotCancelReason- The reason which will be provided in the cancel responses.
-
hasFlag
Returns whether this request has the provided flag.- Parameters:
requestFlag- the request flag to test for- Returns:
trueif this request has the provided flag
-
setFlag
Sets the provided flag for this request.- Parameters:
requestFlag- the request flag
-
getMessageId
public int getMessageId()Returns the message id associated to the request.- Returns:
- the message id
-
getOperationId
public long getOperationId()Returns the operation id associated to the request.- Returns:
- the operation id
-
hasPrivilege
Returnstrueif the authorized user has the specified privilege.- Parameters:
privilege- The required privilege- Returns:
trueif the authorized user has the specified privilege
-
getClientConnection
Returns the client connection associated with this request.- Returns:
- the client connection associated with this request
-
getJfrRequestEvent
Returns the JFR request event associated with this request.- Returns:
- the JFR request event associated with this request
-
notifyProcessingStarted
public void notifyProcessingStarted()Signals that this request is no long queuing and is about to be processed. -
notifyProcessingCompleted
public void notifyProcessingCompleted()Signals that this request has completed processing. This does not include sending the result. -
getReceiveTime
public long getReceiveTime()Returns the time since the epoch when the request was received.- Returns:
- the time since the epoch when the request was received
-
getProcessingCompleteTime
public long getProcessingCompleteTime()Returns the time since the epoch when processing the request completed.- Returns:
- the time since the epoch when processing the request completed
-
getElapsedProcessingTime
public long getElapsedProcessingTime()Returns the elapsed processing time for the request.- Returns:
- the elapsed processing time for the request
-
getElapsedQueueingTime
public long getElapsedQueueingTime()Returns the elapsed queueing time for the request.- Returns:
- the elapsed queueing time for the request
-
getElapsedTotalTime
public long getElapsedTotalTime()Returns the elapsed total time for the request.- Returns:
- the elapsed total time for the request
-
getElapsedTimeUnit
Returns the time unit that is used for reporting elapsed times of the request.- Returns:
- the time unit that is used for reporting elapsed times of the request
-
getMaskedResultCode
Retrieves the real, masked result code for this operation.- Returns:
- The real, masked result code associated for this operation, or
nullif there is no need for one
-
setMaskedResultCode
Specifies the real, masked result code for this operation. This method may not be called by post-response plugins. Anullvalue will reset to not having a masked error code to log.- Parameters:
maskedResultCode- The real, masked result code for this operation Ifnull, the masked error message will be removed.
-
getMaskedErrorMessage
Retrieves the real, masked error message for this operation. Its contents may be altered by pre-parse, pre-operation, and post-operation plugins, but not by post-response plugins.- Returns:
- The real, masked error message for this operation or
nullif none has been set
-
setMaskedErrorMessage
Sets the masked error message. This method may not be called by post-response plugins.- Parameters:
maskedErrorMessage- the masked error message
-
setMatchedNamingContext
Sets the matched naming context. This method may not be called by post-response plugins.- Parameters:
matchedNamingContext- the matched naming context
-
getProxiedAuthorizationDn
Returns the proxied authorization DN if proxy authorization has been requested.- Returns:
- the proxied Authorization DN or
nullis proxy authorization has not been requested
-
setProxiedAuthorizationDn
Set the proxied authorization DN for this operation if any.- Parameters:
proxiedAuthorizationDn- The proxied authorization DN. ifnullthis operation will have no proxy authorization.
-
getSearchResultEntryCount
public int getSearchResultEntryCount()Returns the number of entries sent by the search request associated to this context.- Returns:
- the number of entries sent by the search request associated to this context
-
incrementSearchResultEntryCount
public void incrementSearchResultEntryCount()Increments the number of entries returned by the search request associated to this context. -
getAdditionalLogItems
Returns additional information to be logged, as a potentially emptyListofAdditionalLogItem.- Returns:
- additional information to be logged, as a potentially empty
ListofAdditionalLogItem
-
addAdditionalLogItem
Adds aAdditionalLogItemto the list for logging.nullitems will be ignored.- Parameters:
item- the additional log item to add
-
setAdditionalLogItems
Sets theAdditionalLogItems. All existing elements will be deleted.- Parameters:
items- the new log items
-
getLargestEntrySize
public long getLargestEntrySize()Returns the size of the largest entry targeted by the request.- Returns:
- the size of the largest entry targeted by the request
-
getTotalEntriesSize
public long getTotalEntriesSize()Returns the accumulated entries size.- Returns:
- the accumulated entries size
-
matchedNamingContext
Returns the matched naming context.- Returns:
- the matched naming context
-
recordEntrySize
public void recordEntrySize(long size) Update the entry size statisticstotalEntriesSizeandlargestEntrySizeof the entries that have been accessed by the request.- Parameters:
size- The size of the entry that has been accessed by the request.
-
getThreadNameForRequest
-