eneter.messaging.messagingsystems.httpmessagingsystem
Class HttpPolicyServer

java.lang.Object
  extended by eneter.messaging.messagingsystems.httpmessagingsystem.HttpPolicyServer

public class HttpPolicyServer
extends java.lang.Object

HTTP 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 TcpPolicyServer.) Windows Phone 7 (based on Silverlight 3 too) does not require the policy server.

The HTTP policy server is a special service listening to the HTTP root address. When it receives the request with the path '/clientaccesspolicy.xml', it returns the content of the policy file.

Silverlight automatically uses this service before an HTTP request is invoked. If the Silverlight application invokes the HTTP request (e.g. http://127.0.0.1/MyService/), Silverlight first sends the request on the root (i.e. http://127.0.0.1/) 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 original HTTP request is not performed.


Constructor Summary
HttpPolicyServer(java.lang.String httpRootAddress)
          Constructs the Http policy server.
 
Method Summary
 java.lang.String getPolicyXml()
          Gets the policy xml.
 boolean isListening()
          Returns true, if this instance of policy server is listening to requests.
 void setPolicyXml(java.lang.String policyXml)
          Sets the 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

HttpPolicyServer

public HttpPolicyServer(java.lang.String httpRootAddress)
                 throws java.lang.Exception
Constructs the Http policy server.

Parameters:
httpRootAddress - root Http address. E.g. if the serivice has the address http://127.0.0.1/MyService/, the root address will be http://127.0.0.1/.
Throws:
java.lang.Exception
Method Detail

getPolicyXml

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

Returns:

setPolicyXml

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

Parameters:
policyXml -
Throws:
java.lang.Exception

isListening

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

Returns:
Throws:
java.lang.Exception

startPolicyServer

public void startPolicyServer()
                       throws java.lang.Exception
Starts the policy server. It starts the thread listening to HTTP requests and responding the policy file.

Throws:
java.lang.Exception

stopPolicyServer

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