org.aselect.system.communication.server
Class TCPProtocolResponse

java.lang.Object
  extended by org.aselect.system.communication.server.TCPProtocolResponse
All Implemented Interfaces:
IProtocolResponse

public class TCPProtocolResponse
extends java.lang.Object
implements IProtocolResponse

Wrapper to add data and headers to an outgoing Socket response.

Description:
Protocol information (e.g. headers) can be set by calling the setProperty() method. The properties are placed in a Hashtable. When the getOutputStream() method is called the headers will first be written to the OutputStream of the socket.

The TCPProtocolResponse can also be used in the Communicatorand message creator objects ( IMessageCreatorInterface).

Concurrency issues:
Every reponse should have its own TCPProtocolResponse instance.

Author:
Alfa & Ariss

Constructor Summary
TCPProtocolResponse(java.net.Socket oResponseSocket, java.lang.String sProtocolName)
          Create a new instance.
 
Method Summary
 java.io.OutputStream getOutputStream()
          Get the ouput stream to the response message.
 void setProperty(java.lang.String sName, java.lang.String sValue)
          Set a property of the response protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPProtocolResponse

public TCPProtocolResponse(java.net.Socket oResponseSocket,
                           java.lang.String sProtocolName)
Create a new instance.

Description:
Creates a new instance with sProtocolName and the given socket.

Concurrency issues:
-

Preconditions:

Postconditions:
All instance variables are intialized.

Parameters:
oResponseSocket - The Socket with the outgoing response.
sProtocolName - The protocol name that will be contained in the first line (response code) of the outgoing response
Method Detail

setProperty

public void setProperty(java.lang.String sName,
                        java.lang.String sValue)
Set a property of the response protocol.

Specified by:
setProperty in interface IProtocolResponse
Parameters:
sName - the name of the property that has to be set.
sValue - the value that has to be set.
See Also:
IProtocolResponse.setProperty(java.lang.String, java.lang.String)

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Get the ouput stream to the response message.

Specified by:
getOutputStream in interface IProtocolResponse
Returns:
OutputStream to which the response message can be send.
Throws:
java.io.IOException - if OutputStream can't be retrieved from the protocol
See Also:
IProtocolResponse.getOutputStream()


Copyright © 2008 SURFnet BV. All Rights Reserved.