# OpenORB 1.3.1: Interface ClientRequest

## org.openorb.net
Interface ClientRequest

All Superinterfaces:
  ClientRequestInfo, ClientRequestInfoOperations, IDLEntity, Object, RequestInfo, RequestInfoOperations, java.io.Serializable

All Known Implementing Classes:
  AbstractClientRequest

public interface ClientRequest
extends ClientRequestInfo

Interface for client requests. The client request holds all the data concering a request. The client request object is responsible for request state management, managing interception points and the various policies affecting a single request.

Version:
  $Revision: 1.5 $ $Date: 2002/06/28 08:59:05 $
Author:
  Chris Wood

Field Summary
`static short` `OBJECT_HERE` Extra reply status denoting a locate request found the object.
`static int` `STATE_COMPLETE` Request is complete.
`static int` `STATE_CREATED` Request created.
`static int` `STATE_MARSHAL` While in MARSHAL arguments are marshaled into the input stream and message fragments may be sent.
`static int` `STATE_UNMARSHAL` Response is being unmarshaled.
`static int` `STATE_WAITING` Waiting for a response from the server.
`static short` `UNKNOWN_OBJECT` Extra reply status denoting a locate request where the object is not found

Method Summary
`Address` `address()` Client address
`OutputStream` `begin_marshal()` Begin marshalling arguments.
`boolean` `cancel(SystemException ex)` Cancel the request with the specified system exception reply.
`ClientChannel` `channel()` Client channel
`IOR` `effective_target_ior()` Get the effective target IOR.
`IOR` `forward_reference_ior()` Get the ior associated with a forward reference.
`ServiceContext[]` `get_request_service_contexts()` Get all request service contexts that have been set.
`java.lang.Object` `get_transport_association()` Get the transport association.
`boolean` `is_locate()` This returns true if this request is a locate request.
`boolean` `is_poll()` Request is a poll.
`boolean` `is_request()` This returns true if this request is a standard request.
`ORB` `orb()` ORB associated with the target.
`boolean` `poll_response()` Poll to see if a response is available from the target.
`InputStream` `receive_response()` Get the response output stream.
`java.lang.String` `received_exception_id()` Get the ID of the system exception which would be contained in the any returned from receive_exception.
`SystemException` `received_system_exception()` Get the system exception which would be contained in the any returned from receive_exception.
`int` `send_request()` When this returns the last fragment of the request has been sent.
`int` `state()` Current request state.
`IOR` `target_ior()` Get the target IOR.
`int` `wait_for_response(long timeout)` Wait for a response from the server.

Methods inherited from interface org.omg.PortableInterceptor.ClientRequestInfoOperations
`add_request_service_context, effective_profile, effective_target, get_effective_component, get_effective_components, get_request_policy, received_exception, target`

Methods inherited from interface org.omg.PortableInterceptor.RequestInfoOperations
`arguments, contexts, exceptions, forward_reference, get_reply_service_context, get_request_service_context, get_slot, operation_context, operation, reply_status, request_id, response_expected, result, sync_scope`

Methods inherited from interface org.omg.CORBA.Object
`_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_interface, _get_policy, _hash, _is_a, _is_equivalent, _non_existent, _release, _request, _set_policy_override`

Field Detail

### OBJECT_HERE

    public static final short OBJECT_HERE

  Extra reply status denoting a locate request found the object.

### UNKNOWN_OBJECT

    public static final short UNKNOWN_OBJECT

  Extra reply status denoting a locate request where the object is not found

### STATE_CREATED

    public static final int STATE_CREATED

  Request created. Client side interception points send_request/send_poll are called while in this state.

### STATE_MARSHAL

    public static final int STATE_MARSHAL

  While in MARSHAL arguments are marshaled into the input stream and message fragments may be sent.

### STATE_WAITING

    public static final int STATE_WAITING

  Waiting for a response from the server.

### STATE_UNMARSHAL

    public static final int STATE_UNMARSHAL

  Response is being unmarshaled. This state is reached when a reply is arriving and reply_status is either SUCESSFUL or USER_EXCEPTION. Terminating client side interceptors will not have been called yet.

### STATE_COMPLETE

    public static final int STATE_COMPLETE

  Request is complete. Last fragment has been unmarshalled and all terminating interception points have occoured. To determine the exact response call the reply_status function.

Method Detail

### channel

    public ClientChannel channel()

  Client channel

### address

    public Address address()

  Client address

### orb

    public ORB orb()

  ORB associated with the target.

### target_ior

    public IOR target_ior()

  Get the target IOR. This calls ior() on the object passed with creation

### effective_target_ior

    public IOR effective_target_ior()

  Get the effective target IOR. This gets the IOR from the address passed in creation. Calling this function instead of effective_target avoids constructing an enclosing delegate/object.

### get_transport_association

    public java.lang.Object get_transport_association()

  Get the transport association.

### state

    public int state()

  Current request state.

### cancel

    public boolean cancel(SystemException ex)

  Cancel the request with the specified system exception reply. This is valid in any state apart from COMPLETE. This may result in cancel messages being sent to the server. If the cancel is successful state changes to COMPLETED/SYSTEM_EXCEPTION. If the provided exception's status is set to null the exception thown will set the exception status according to the request's state.
  Returns:
    true if the request is succesfully canceled.

### is_request

    public boolean is_request()

  This returns true if this request is a standard request. While in the CREATED state it is valid to call any client request info operations which would be valid in the client side interception points send_request. The send_request interception points are called while in this state.

### is_poll

    public boolean is_poll()

  Request is a poll. While in the CREATED state it is valid to call any client request info operations which would be valid in the client side interception points send_poll. The send_poll interception points are called while in this state.

### is_locate

    public boolean is_locate()

  This returns true if this request is a locate request. Client side interceptors are not called for locate requests. ClientRequestInfo operations: arguments, exceptions, contexts, operation_context, result, get_request_service_context, get_reply_service_context, add_request_service_context are not valid. operation returns the empty string "", response_expected returns true. Note the extra values for reply_status, UNKNOWN_OBJECT and OBJECT_HERE

### begin_marshal

    public OutputStream begin_marshal()

  Begin marshalling arguments. Valid in CREATED state. All client side interception points send_request/send_poll complete and state changes to MARSHAL. If no arguments are required for marshalling this can enter the MARSHAL state and return null, this occours for locate requests and polls only. This may also return null if entering COMPLETE/SYSTEM_EXCEPTION/COMPLETED_NO, COMPLETE/LOCATION_FORWARD or COMPLETE/LOCATION_FORWARD_PERMINENT due to communication problems or client side interceptors.

### get_request_service_contexts

    public ServiceContext[] get_request_service_contexts()

  Get all request service contexts that have been set. From MARSHAL onward this will be a constant list.

### send_request

    public int send_request()

  When this returns the last fragment of the request has been sent. In MARSHAL state changes to WAITING or COMPLETE. This may result in entering COMPLETE/SYSTEM_EXCEPTION/COMPLETED_NO, COMPLETE/LOCATION_FORWARD or COMPLETE/LOCATION_FORWARD_PERMINENT due to communication problems.
  Returns:
    new state. May be WAITING or COMPLETE.

### poll_response

    public boolean poll_response()

  Poll to see if a response is available from the target. If in the WAITING state this will return true if wait_for_response would not have to wait for a response. In the UNMARSHAL and COMPLETE states this returns true, It is illegal to call this function in all other states.

### wait_for_response

    public int wait_for_response(long timeout)

  Wait for a response from the server. When this returns either the given wait_time has expired (WAITING), a response has arrived from the server (UNMARSHAL or COMPLETE), a transport error has occoured (COMPLETE), or for requests where no response is expected the sync scope is satisfied (COMPLETE). The request state will not exit the WAITING state unless this function is called.
  Parameters:
    `timeout` - Maximum amount of time to wait for response. 0 to wait forever, > 0 for some timeout (in ms)
  Returns:
    new state. May be WAITING, UNMARSHAL or COMPLETE.

### receive_response

    public InputStream receive_response()

  Get the response output stream. This function is valid in the UNMARSHAL state when reply_status is SUCESSFUL or USER_EXCEPTION. The returned input stream may throw a system exception with status COMPLETED_YES at any time.

### forward_reference_ior

    public IOR forward_reference_ior()

  Get the ior associated with a forward reference. Calling this function instead of forward_reference avoids creating an enclosing delegate/object. This function is valid in the COMPLETE/LOCATION_FORWARD.

### received_system_exception

    public SystemException received_system_exception()

  Get the system exception which would be contained in the any returned from receive_exception. This function is valid in the COMPLETE/SYSTEM_EXCEPTION state.

### received_exception_id

    public java.lang.String received_exception_id()

  Get the ID of the system exception which would be contained in the any returned from receive_exception. This function is valid in the COMPLETE/SYSTEM_EXCEPTION, UNMARSHAL/USER_EXCEPTION and COMPLETE/USER_EXCEPTION states.
  Specified by:
    `received_exception_id` in interface `ClientRequestInfoOperations`
  Following copied from interface: `org.omg.PortableInterceptor.ClientRequestInfoOperations`
  Returns:
    the attribute value