## org.openorb.net
Interface ServerRequest

All Superinterfaces:
  IDLEntity, Object, RequestInfo, RequestInfoOperations, ResponseHandler, java.io.Serializable, ServerRequestInfo, ServerRequestInfoOperations

All Known Implementing Classes:
  AbstractServerRequest

public interface ServerRequest
extends ServerRequestInfo, ResponseHandler

Interface for server requests. The server request holds all the data concering a request. It is responsible for interpreting incoming requests, locating an adapter containing the target servant, calling interception points and construting a reply.

Author:
  Unknown

Field Summary
`static short` `OBJECT_HERE` Extra reply status denoting a locate request found the object.
`static int` `STATE_COMPLETE` Request has completed.
`static int` `STATE_CREATED` The request has arrived but has not had any of it's service contexts examined.
`static int` `STATE_FIND_ADAPTER` This state is entered if a parent adapter is either holding requests or is in the process of being destroyed.
`static int` `STATE_PROCESSING` Request is being processed.
`static int` `STATE_QUEUED` Request has had an adapter found and is enqueued awaiting dispatch.
`static int` `STATE_REPLY` Replying, one of the response handlers functions have been called or an an internal response is being constructed.
`static short` `UNKNOWN_OBJECT` Extra reply status denoting a locate request where the object is not found

Method Summary
`ObjectAdapter` `adapter()` Server adapter.
`int` `adapter(ObjectAdapter adapter)` Set the object adapter and transfer to the QUEUED state.
`InputStream` `argument_stream()` Get the request input stream.
`int` `begin_request()` Called by the worker thread before every attempt to run the request.
`ServerChannel` `channel()` Server channel
`void` `client_cancel()` Client intiated request cancelation.
`OutputStream` `createExceptionReply()` Create a stream for marshaling a user exception.
`OutputStream` `createReply()` Create a stream for marshaling the reply.
`void` `dispatch()` Dispatch a request to it's destination.
`IOR` `forward_reference_ior()` Get the ior associated with a forward reference.
`ServiceContext[]` `get_reply_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.
`byte[]` `object_key()` Get the object_key for the request.
`ORB` `orb()` ORB reference.
`java.lang.String` `sending_system_exception_id()` Get the ID of the system exception which would be contained in the any returned from sending_exception.
`SystemException` `sending_system_exception()` Get the system exception which would be contained in the any returned from sending_exception.
`void` `server_cancel(java.lang.Throwable ex)` Server intiated request cancelation.
`int` `state()` Current request state.

Methods inherited from interface org.omg.PortableInterceptor.ServerRequestInfoOperations
`adapter_id, add_reply_service_context, get_server_policy, object_id, sending_exception, set_slot, target_is_a, target_most_derived_interface`

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

  The request has arrived but has not had any of it's service contexts examined. A cancelation in this state will result in COMPLETED_NO status. Calls valid in receive_request_service_contexts are valid, this interception point will occour while in this state if the request is not a locate request.

### STATE_FIND_ADAPTER

    public static final int STATE_FIND_ADAPTER

  This state is entered if a parent adapter is either holding requests or is in the process of being destroyed. To continue find_adapter must be called again.

### STATE_QUEUED

    public static final int STATE_QUEUED

  Request has had an adapter found and is enqueued awaiting dispatch. Calls valid in receive_request_service_contexts are valid. Request fragments may still be arriving.

### STATE_PROCESSING

    public static final int STATE_PROCESSING

  Request is being processed. This is the only state where the ReplyHandler functions can be successfully called. Request fragments may still be arriving.

### STATE_REPLY

    public static final int STATE_REPLY

  Replying, one of the response handlers functions have been called or an an internal response is being constructed. The send_* interception points are called in this state.

### STATE_COMPLETE

    public static final int STATE_COMPLETE

  Request has completed. Terminating state.

Method Detail

### orb

    public ORB orb()

  ORB reference.

### channel

    public ServerChannel channel()

  Server channel

### state

    public int state()

  Current request state.

### object_key

    public byte[] object_key()

  Get the object_key for the request. This is always available.

### get_reply_service_contexts

    public ServiceContext[] get_reply_service_contexts()

  Get all request service contexts that have been set. Valid in REPLY and COMPLETE.

### is_locate

    public boolean is_locate()

  This returns true if this request is a locate request. Use replyLocate to set the reply. Interceptors are not called for locate requests. ServerRequestInfo operations: arguments, exceptions, contexts, operation_context, result, get_request_service_context, get_reply_service_context, add_reply_service_context are not valid. operation returns the empty string "", response_expected returns true. Note the extra value for reply_status, UNKNOWN_OBJECT.

### get_transport_association

    public java.lang.Object get_transport_association()

  Get the transport association.

### client_cancel

    public void client_cancel()

  Client intiated request cancelation. This may be called at any time to indicate that a response from the request is no longer expected.

### server_cancel

    public void server_cancel(java.lang.Throwable ex)

  Server intiated request cancelation. This may be called at any time apart from during a find_adapter or dispatch call to indicate a server initiated cancel. This will send a reply to the client.

### begin_request

    public int begin_request()

  Called by the worker thread before every attempt to run the request. This should call the recieve_request_service_context interception point.
  Returns:
    the state of the request.

### adapter

    public int adapter(ObjectAdapter adapter)

  Set the object adapter and transfer to the QUEUED state. This is legal only in the FIND_ADAPTER or COMPLETE states. If COMPLETE this has no effect.
  Returns:
    the state of the request. This will be either QUEUED or COMPLETE.

### adapter

    public ObjectAdapter adapter()

  Server adapter. This operation is valid in all states apart from CREATED. When a dispatch operation fails this will return the original adapter.

### dispatch

    public void dispatch()
                  throws AdapterDestroyedException

  Dispatch a request to it's destination. This is valid in the QUEUED state Call predispatch on the adapter to locate the target, call the receive_request interception points, enter the PROCESSING state and dispatch the request through the adapter. If sync scope is SYNC_WITH_SERVER an empty response will be sent before the request is dispatched. When this function returns all the terminating interception points will have been called, and state will be COMPLETE. If the target adapter is destroyed between the find_adapter and dispatch this function will return false and the CREATED state is re-entered, in this case the find_adapter function will be called again once the unregister adapter operation is called on the server manager with the target adapter.

### argument_stream

    public InputStream argument_stream()

  Get the request input stream. This function can be called only once while in the PROCESSING state. The returned input stream may throw a system exception if some problem occours while unmarshalling the request arguments. This function, and the reply functions must be called by the same thread, the thread that called the dispatch function.

### createReply

    public OutputStream createReply()

  Create a stream for marshaling the reply. The send_reply interception points are called, if this results in a system exception the exception is thrown, otherwise a stream is retured. The returned stream may raise a system exception when attempting to write to it indicating a transmission problem. Such an exception is not reported to interceptors. This function is inherited from the ResponseHandler interface.
  Specified by:
    `createReply` in interface `ResponseHandler`

### createExceptionReply

    public OutputStream createExceptionReply()

  Create a stream for marshaling a user exception. The send_exception interception points are called, if this results in a system exception the exception is thrown, otherwise a stream is retured. The returned stream may raise a system exception when attempting to write to it indicating a transmission problem. Such an exception is not reported to interceptors. This function is inherited from the ResponseHandler interface.
  Specified by:
    `createExceptionReply` in interface `ResponseHandler`

### 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 REPLY and COMPLETE states where reply_status would return LOCATION_FORWARD.

### sending_system_exception

    public SystemException sending_system_exception()

  Get the system exception which would be contained in the any returned from sending_exception. This function is valid in REPLY and COMPLETE states where reply_status would return SYSTEM_EXCEPTION.

### sending_system_exception_id

    public java.lang.String sending_system_exception_id()

  Get the ID of the system exception which would be contained in the any returned from sending_exception. This function is valid in REPLY and COMPLETE states where reply_status would return SYSTEM_EXCEPTION.