Return-Path: X-Original-To: apmail-karaf-commits-archive@minotaur.apache.org Delivered-To: apmail-karaf-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 570E91802D for ; Sun, 20 Dec 2015 16:00:01 +0000 (UTC) Received: (qmail 95299 invoked by uid 500); 20 Dec 2015 16:00:01 -0000 Delivered-To: apmail-karaf-commits-archive@karaf.apache.org Received: (qmail 95272 invoked by uid 500); 20 Dec 2015 16:00:01 -0000 Mailing-List: contact commits-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list commits@karaf.apache.org Received: (qmail 95263 invoked by uid 99); 20 Dec 2015 16:00:01 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Dec 2015 16:00:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id BB4211804BD for ; Sun, 20 Dec 2015 16:00:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.447 X-Spam-Level: X-Spam-Status: No, score=0.447 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.554, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id cbdS_D0stQoP for ; Sun, 20 Dec 2015 15:59:49 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id 7EDC7439F6 for ; Sun, 20 Dec 2015 15:59:46 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5C117E0EDD for ; Sun, 20 Dec 2015 15:59:45 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 5C39F3A17D2 for ; Sun, 20 Dec 2015 15:59:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1721040 [6/12] - in /karaf/site/production/manual/cellar/latest-4: ./ architecture-guide/ user-guide/ Date: Sun, 20 Dec 2015 15:59:45 -0000 To: commits@karaf.apache.org From: jbonofre@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151220155945.5C39F3A17D2@svn01-us-west.apache.org> Added: karaf/site/production/manual/cellar/latest-4/http-session.html URL: http://svn.apache.org/viewvc/karaf/site/production/manual/cellar/latest-4/http-session.html?rev=1721040&view=auto ============================================================================== --- karaf/site/production/manual/cellar/latest-4/http-session.html (added) +++ karaf/site/production/manual/cellar/latest-4/http-session.html Sun Dec 20 15:59:44 2015 @@ -0,0 +1,617 @@ + + + + + + + +HTTP Session Replication + + + + + + +
+
+

HTTP Session Replication

+
+
+

Apache Karaf Cellar supports replication of the HTTP sessions on the cluster.

+
+
+

It means that the same web application deployed on multiple nodes in the cluster will share the same HTTP sessions +pool, allowing clients to transparently connect to any node, without loosing any session state.

+
+
+

Enable Cluster HTTP Session Replication

+
+

In order to be able to be stored on the cluster, all HTTP Sessions used in your web application have to implement +Serializable interface. Any non-serializable attribute has to be flagged as transient.

+
+
+

You have to enable a specific filter in your application to enable the replication. See next chapter for details.

+
+
+

At runtime level, you just have to install http, http-whiteboard, and cellar features:

+
+
+
+
karaf@root()> feature:install http
+karaf@root()> feature:install http-whiteboard
+karaf@root()> feature:repo-add cellar
+karaf@root()> feature:install cellar
+
+
+
+
+

Web Application Session Replication

+
+

In order to use HTTP session replication on the cluster, you just have to add a filter in your web application.

+
+
+

Basically, the WEB-INF/web.xml file of your web application should look like this:

+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+	version="3.0">
+
+	<filter>
+		<filter-name>hazelcast-filter</filter-name>
+		<filter-class>com.hazelcast.web.WebFilter</filter-class>
+	    <!--
+	        Name of the distributed map storing
+	        your web session objects
+	    -->
+		<init-param>
+			<param-name>map-name</param-name>
+			<param-value>my-sessions</param-value>
+		</init-param>
+	    <!-- How is your load-balancer configured? stick-session means all requests of
+	    	a session is routed to the node where the session is first created. This is
+	    	excellent for performance. If sticky-session is set to false, when a session
+	    	 is updated on a node, entry for this session on all other nodes is invalidated.
+	    	 You have to know how your load-balancer is configured before setting this
+	    	 parameter. Default is true. -->
+		<init-param>
+			<param-name>sticky-session</param-name>
+			<param-value>false</param-value>
+		</init-param>
+	    <!--
+	        Are you debugging? Default is false.
+	    -->
+		<init-param>
+			<param-name>debug</param-name>
+			<param-value>false</param-value>
+		</init-param>
+	</filter>
+	<filter-mapping>
+		<filter-name>hazelcast-filter</filter-name>
+		<url-pattern>/*</url-pattern>
+		<dispatcher>FORWARD</dispatcher>
+		<dispatcher>INCLUDE</dispatcher>
+		<dispatcher>REQUEST</dispatcher>
+	</filter-mapping>
+	<listener>
+		<listener-class>com.hazelcast.web.SessionListener</listener-class>
+	</listener>
+
+</web-app>
+
+
+
+
+
+
+ + + \ No newline at end of file