java.lang.Object
com.zeroc.Ice.Current
- All Implemented Interfaces:
Cloneable
Provides information about an incoming request being dispatched.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ObjectAdapter
The object adapter that received the request.final Connection
The connection that received the request.The request context.The encoding of the request payload.The facet of the target Ice object.final Identity
The identity of the target Ice object.The operation mode (idempotent or not).The name of the operation.final int
The request ID. -
Constructor Summary
ConstructorsConstructorDescriptionCurrent
(ObjectAdapter adapter, Connection con, Identity id, String facet, String operation, OperationMode mode, Map<String, String> ctx, int requestId, EncodingVersion encoding) Constructs a Current object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Ensures the operation mode of an incoming request is not idempotent.clone()
Creates an empty outgoing response with reply statusReplyStatus.Ok
.createOutgoingResponse
(boolean ok, byte[] encapsulation) Creates an outgoing response with the specified payload.createOutgoingResponse
(Throwable exception) Creates an outgoing response that marshals an exception.<TResult> OutgoingResponse
createOutgoingResponse
(TResult result, BiConsumer<OutputStream, TResult> marshal, FormatType formatType) Creates an outgoing response with reply statusReplyStatus.Ok
.Starts the output stream for a successful reply, with everything up to and including the reply status.
-
Field Details
-
adapter
The object adapter that received the request. -
con
The connection that received the request. It's null when the invocation and dispatch are collocated. -
id
The identity of the target Ice object. -
facet
The facet of the target Ice object. -
operation
The name of the operation. -
mode
The operation mode (idempotent or not). -
ctx
The request context. -
requestId
public final int requestIdThe request ID. 0 means the request is a one-way request. -
encoding
The encoding of the request payload.
-
-
Constructor Details
-
Current
public Current(ObjectAdapter adapter, Connection con, Identity id, String facet, String operation, OperationMode mode, Map<String, String> ctx, int requestId, EncodingVersion encoding) Constructs a Current object.- Parameters:
adapter
- The adapter.con
- The connection. Can be null.id
- The identity of the target object.facet
- The facet of the target object.operation
- The name of the operation.mode
- The operation mode.ctx
- The request context.requestId
- The request ID.encoding
- The encoding of the payload.
-
-
Method Details
-
checkNonIdempotent
public void checkNonIdempotent()Ensures the operation mode of an incoming request is not idempotent. The generated code calls this method to ensure that when an operation's mode is not idempotent (locally), the incoming request's operation mode is not idempotent.- Throws:
MarshalException
- Thrown when the request's operation mode isOperationMode.Idempotent
orOperationMode.Nonmutating
.
-
clone
-
createOutgoingResponse
public <TResult> OutgoingResponse createOutgoingResponse(TResult result, BiConsumer<OutputStream, TResult> marshal, FormatType formatType) Creates an outgoing response with reply statusReplyStatus.Ok
.- Type Parameters:
TResult
- The type of result.- Parameters:
result
- The result to marshal into the response payload.marshal
- The action that marshals result into an output stream.formatType
- The class format.- Returns:
- A new outgoing response.
-
createEmptyOutgoingResponse
Creates an empty outgoing response with reply statusReplyStatus.Ok
.- Returns:
- An outgoing response with an empty payload.
-
createOutgoingResponse
Creates an outgoing response with the specified payload.- Parameters:
ok
- When true, the reply status of the response isReplyStatus.Ok
; otherwise, it'sReplyStatus.UserException
.encapsulation
- The payload of the response.- Returns:
- A new outgoing response.
-
createOutgoingResponse
Creates an outgoing response that marshals an exception.- Parameters:
exception
- The exception to marshal into the response payload.- Returns:
- A new outgoing response.
-
startReplyStream
Starts the output stream for a successful reply, with everything up to and including the reply status. When the request ID is 0 (one-way request), the returned output stream is empty.- Returns:
- The new output stream with status ReplyStatus.Ok.
-