com.boylesoftware.cb2.bcmproviders.http
Class HttpBCMProvider

java.lang.Object
  extended bycom.boylesoftware.cb2.bcmproviders.http.HttpBCMProvider
All Implemented Interfaces:
BroadcastMessagingProvider

public final class HttpBCMProvider
extends java.lang.Object
implements BroadcastMessagingProvider

Implementation of the BroadcastMessagingProvider interface which uses HTTP to deliver messages to the members of the cluster.

This provider implementation requires a special servlet deployed on every member of the cluster. The servlet is implemented by ReceiverServlet class and can be deployed in the web.xml file as follows:

 ...

 <servlet>
   <servlet-name>bcmreceiver</servlet-name>
   <display-name>The CB2 BCM Receiver</display-name>
   <servlet-class>com.boylesoftware.cb2.bcmproviders.http.ReceiverServlet</servlet-class>
   <load-on-startup>12</load-on-startup>
 </servlet>

 ...

 <servlet-mapping>
   <servlet-name>bcmreceiver</servlet-name>
   <url-pattern>/cb2-bcm</url-pattern>
 </servlet-mapping>

 ...

It is not necessary to protect the receiver servlet's URL, because it always checks that the request comes with the same password specified by com.boylesoftware.cb2.broadcastMessaging.http.password application property. This also means that this property has to have the same value on all the cluster members. The password is passed as a request parameter and is clear text though, so for better security you may consider protecting the URL restricting access, for example, only to the cluster members' IP addresses.

This implementation uses the following application parameters:

Version:
$Id: HttpBCMProvider.java,v 1.5 2004/04/08 18:32:23 levahim Exp $
Author:
Lev Himmelfarb

Field Summary
 
Fields inherited from interface com.boylesoftware.cb2.BroadcastMessagingProvider
LOG_SUBSYS
 
Constructor Summary
HttpBCMProvider()
           
 
Method Summary
 void broadcastMessage(java.lang.String channelName, java.io.Serializable messageParam)
          Send a message to all cluster members.
 void destroy()
          Destroy the provider.
 void init(ApplicationContext appCtx)
          Initialize the provider instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpBCMProvider

public HttpBCMProvider()
Method Detail

init

public void init(ApplicationContext appCtx)
          throws ApplicationException
Initialize the provider instance.

Specified by:
init in interface BroadcastMessagingProvider
Parameters:
appCtx - the application context.
Throws:
ApplicationException - if a serious error has happened and the provider cannot be initialized.

destroy

public void destroy()
Destroy the provider.

Specified by:
destroy in interface BroadcastMessagingProvider

broadcastMessage

public void broadcastMessage(java.lang.String channelName,
                             java.io.Serializable messageParam)
Send a message to all cluster members.

Specified by:
broadcastMessage in interface BroadcastMessagingProvider
Parameters:
channelName - logical name of the channel, to which the message is targeted.
messageParam - optional message parameter, may be null.


Copyright © 2002,2003,2004 - Boyle Software, Inc.