org.objectweb.jonathan.protocols.api
Interface ReplySession


public interface ReplySession

A reply session is used by a server to send a reply back to a client.


Method Summary
 void close()
          Closes the session, letting the associated resources be released or reused.
 Marshaller prepareExceptionReply()
          Lets the target session write its own headers into a newly created message and returns it (exception case)
 Marshaller prepareLocationForwardReply()
          Lets the target session write its own headers into a newly created message and returns it (location forward case)
 Marshaller prepareReply()
          Lets the target session write its own headers into a newly created message and returns it (standard reply case)
 Marshaller prepareSystemExceptionReply()
          Lets the target session write its own headers into a newly created message and returns it (system exception case)
 void send(Marshaller m)
          Sends the reply down the protocol stack.
 

Method Detail

prepareReply

public Marshaller prepareReply()
                        throws org.objectweb.jonathan.apis.kernel.JonathanException
Lets the target session write its own headers into a newly created message and returns it (standard reply case)

An entity wishing to send a message as a reply to an invocation must not create a marshaller on its own and directly send it down the protocol stack. Instead, it must ask the session for a marshaller, into which the session will usually already have written its specific headers.

The prepareException method must only be used to prepare messages corresponding to a non-exceptional reply from the server. If the reply corresponds to an exception raised by the server, use prepareExceptionReply instead.

Returns:
a marshaller to write the reply into;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

prepareExceptionReply

public Marshaller prepareExceptionReply()
                                 throws org.objectweb.jonathan.apis.kernel.JonathanException
Lets the target session write its own headers into a newly created message and returns it (exception case)

An entity wishing to send a message as a reply to an invocation must not create a marshaller on its own and directly send it down the protocol stack. Instead, it must ask the session for a marshaller, into which the session will usually already have written its specific headers.

The prepareExceptionReply method must only be used to prepare messages corresponding to an exception raised by the server.

Returns:
a marshaller to write the reply into;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

prepareSystemExceptionReply

public Marshaller prepareSystemExceptionReply()
                                       throws org.objectweb.jonathan.apis.kernel.JonathanException
Lets the target session write its own headers into a newly created message and returns it (system exception case)

An entity wishing to send a message as a reply to an invocation must not create a marshaller on its own and directly send it down the protocol stack. Instead, it must ask the session for a marshaller, into which the session will usually already have written its specific headers.

The prepareSystemExceptionReply method must only be used to prepare messages corresponding to an system exception raised by the server.

Returns:
a marshaller to write the reply into;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

prepareLocationForwardReply

public Marshaller prepareLocationForwardReply()
                                       throws org.objectweb.jonathan.apis.kernel.JonathanException
Lets the target session write its own headers into a newly created message and returns it (location forward case)

An entity wishing to send a message as a reply to an invocation must not create a marshaller on its own and directly send it down the protocol stack. Instead, it must ask the session for a marshaller, into which the session will usually already have written its specific headers.

The prepareLocationForwardReply method must only be used to prepare messages corresponding to an location forward message raised by the server.

Returns:
a marshaller to write the reply into;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

send

public void send(Marshaller m)
          throws org.objectweb.jonathan.apis.kernel.JonathanException
Sends the reply down the protocol stack.

The sent message must have been obtained by calling the prepareReply or prepareExceptionReply method.

It is the responsibility of the recipient of the message to close it.

Parameters:
m - the message to send;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

close

public void close()
Closes the session, letting the associated resources be released or reused.

Sessions may have an exclusive access to a communication resource. It is thus very important to ensure that they are properly closed if they are no longer in use.