Package com.zeroc.Ice

Class Current

java.lang.Object
com.zeroc.Ice.Current
All Implemented Interfaces:
Cloneable

public final class Current extends Object implements Cloneable
Provides information about an incoming request being dispatched.
  • Field Details

    • adapter

      public final ObjectAdapter adapter
      The object adapter that received the request.
    • con

      public final Connection con
      The connection that received the request. It's null when the invocation and dispatch are collocated.
    • id

      public final Identity id
      The identity of the target Ice object.
    • facet

      public String facet
      The facet of the target Ice object.
    • operation

      public String operation
      The name of the operation.
    • mode

      public OperationMode mode
      The operation mode (idempotent or not).
    • ctx

      public final Map<String,String> ctx
      The request context.
    • requestId

      public final int requestId
      The request ID. 0 means the request is a one-way request.
    • encoding

      public EncodingVersion 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 is OperationMode.Idempotent or OperationMode.Nonmutating.
    • clone

      public Current clone()
      Overrides:
      clone in class Object
    • createOutgoingResponse

      public <TResult> OutgoingResponse createOutgoingResponse(TResult result, BiConsumer<OutputStream,TResult> marshal, FormatType formatType)
      Creates an outgoing response with reply status ReplyStatus.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

      public OutgoingResponse createEmptyOutgoingResponse()
      Creates an empty outgoing response with reply status ReplyStatus.Ok.
      Returns:
      An outgoing response with an empty payload.
    • createOutgoingResponse

      public OutgoingResponse createOutgoingResponse(boolean ok, byte[] encapsulation)
      Creates an outgoing response with the specified payload.
      Parameters:
      ok - When true, the reply status of the response is ReplyStatus.Ok; otherwise, it's ReplyStatus.UserException.
      encapsulation - The payload of the response.
      Returns:
      A new outgoing response.
    • createOutgoingResponse

      public OutgoingResponse createOutgoingResponse(Throwable exception)
      Creates an outgoing response that marshals an exception.
      Parameters:
      exception - The exception to marshal into the response payload.
      Returns:
      A new outgoing response.
    • startReplyStream

      public OutputStream 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.