600 IBM WebSphere Host Publisher Version 3.5
19.4 Application considerations
When using the Host Publisher Studio to create applications for a cloned
environment, you will need to enable the WebSphere load balancing support.
Note: Host Publisher Studio provides an option to support WebSphere load
balancing so that HTTP session affinity will be established.
Configuration in Host Publisher Studio
In the Host Publisher Studio menu bar, select Options, then check the Support
WebSphere Load balancing option.
Figure 19-6 Enabling the WAS load balancing option in Host Publisher Studio
The following code will be added to your application page by Host Publisher
Studio when this option is used:
<%
HttpSession hp_session = request.getSession(true);
%>
Chapter 19. Cloning and Workload Management (WLM) 601
Integration Object chaining
If you are using WebSphere Application Server for cloning application servers
(JVMs) for load balancing, and you are using Integration Objects chaining in a
servlet or JSP, you must configure HTTP session affinity to ensure that the same
Web client (browser) returns to the JVM that originally established the host
connection.
HTTP session affinity requires WebSphere session persistence to share the
HTTP session object (which represents the connection between the Web client
and the Web server) across multiple application servers. To ensure HTTP
session affinity in a WAS cloned configuration, the HTTP session must be fully
established. The HTTP session is not fully established until the second HTTP
request is sent from the Web client to the Web server. One way to do this is to
check whether the HTTP session is a new session. If so, force a second HTTP
session request to flow between the Web client and the Web server, using the
sendRedirect method of the Java Servlet specification.
The following scenario is one example of how to ensure HTTP session affinity in
a WAS cloned configuration.
1. On all form pages, create an HTTP session object, if one has not already
been created. This prevents the loss of form data.
//-------------------------------------------------------------------------
//Establish session object which can be used by chained applications.
//This is necessary to prevent form POST action from changing to GET
//as the result of the sendRedirect()initiated by the jsp page containing
//the first chained bean.It prevents the loss of parameter,content and
//referer data.
HttpSession hp_session =request.getSession(true);
//-------------------------------------------------------------------------
2. To establish HTTP session affinity before the first Integration Object in a chain
is run, force the second HTTP request to flow back to the Web client for a new
HTTP session.
//-------------------------------------------------------------------------
//Establish session affinity to insure the execution of chained bean
application
//is performed on the same JVM,giving all IO's in chain access to the same
//connection.If this is the target of form page,the session will have
//been previously established and isNew()will return false.
HttpSession hp_session =request.getSession(true);
if (hp_session.isNew()){
String targetURL =request.getServletPath();
Note: The Host Publisher Server provides an option to support WebSphere
load balancing so that HTTP session affinity will be established.

Get A Comprehensive Guide to IBM WebSphere Host Publisher Version 3.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.