eneter.messaging.messagingsystems.tcpmessagingsystem
Class TcpPolicyServer

java.lang.Object
  extended by eneter.messaging.messagingsystems.tcpmessagingsystem.TcpPolicyServer

public class TcpPolicyServer
extends java.lang.Object

TCP policy server needed for the communication with Silverlight applications. The policy server is required by Silverlight for the communication via HTTP or TCP. (See also HttpPolicyServer.)

The TCP policy server is a special service listening on the port 943 (by default for all Ip adresses). When it receives <policy-file-request/> request, it returns the content of the policy file.

Silverlight automatically uses this service before the TCP connection is created. If a Silverlight application wants to open the TCP connection, Silverlight first sends the request on the port 943 and expects the policy file. If the policy server is not there or the content of the policy file does not allow the communication, the Tcp connection is not created.


Constructor Summary
TcpPolicyServer()
          Constructs the TCP policy server providing the policy file on the port 943 for all IP addresses.
TcpPolicyServer(java.net.InetAddress ipAddress)
          Constructs the TCP policy server providing the policy file on the port 943 for the given IP address.
 
Method Summary
 java.lang.String getPolicyXml()
          Gets policy xml.
 boolean isListening()
          Returns true, if this instance of policy server is listening to requests.
 void setPolicyXml(java.lang.String policyXml)
          Sets policy xml.
 void startPolicyServer()
          Starts the policy server.
 void stopPolicyServer()
          Stops the policy server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpPolicyServer

public TcpPolicyServer()
                throws java.lang.Exception
Constructs the TCP policy server providing the policy file on the port 943 for all IP addresses.

Throws:
java.lang.Exception

TcpPolicyServer

public TcpPolicyServer(java.net.InetAddress ipAddress)
Constructs the TCP policy server providing the policy file on the port 943 for the given IP address.

Parameters:
ipAddress -
Method Detail

getPolicyXml

public java.lang.String getPolicyXml()
Gets policy xml.

Returns:
policy xml

setPolicyXml

public void setPolicyXml(java.lang.String policyXml)
Sets policy xml.

Parameters:
policyXml -

isListening

public boolean isListening()
Returns true, if this instance of policy server is listening to requests.

Returns:
true, if this instance of policy server is listening to requests.

startPolicyServer

public void startPolicyServer()
                       throws java.lang.Exception
Starts the policy server. It starts the thread listening to requests on port 943 and responding the policy XML.

Throws:
java.lang.Exception

stopPolicyServer

public void stopPolicyServer()
Stops the policy server. It stops the listening and responding for requests.