Sun Java System Access Manager 2005Q1
Sample
 

Main Page

Application Server Samples Readme File

Integrating with Access Manager on Application Server

This document describes about the deployment issues when the applications (consists of Servlets and JSPs ) are integrating with Access Manager on Sun Java System Application Server.

Access Manager deploys as a war file on Sun Java System Application Server.  Sun Java System Application Server supports multi JVMs, load balancing and hence the performance.  The goal of the load balancing is to evenly distribute the workload between multiple Sun Java System Application Server engines/processes.  But if the requests within the same session are processed by more than one Sun Java System Application Server engine/process, session information that is not configured to be distributed is lost.  Therefore applications which are based on Session information should use sticky load balancing when deploying onto Sun Java System Application Server. Access Manager is a session based application and will use sticky load balancing for it's deployment.

Deployment on Sun Java System Application Server

Sun Java System Application Server needs two XML files  for deploying any kind of applications such as J2EE application, web application, EJB application etc.  Here, we will be dealing with only web application (deploying war file).  For  deploying a war file onto Sun Java System Application Server, the war file should contain web.xml and ias-web.xml.  The web.xml may consists of servlets, JSPs, JSP tag libraries, HTML pages, classes and other resources . This XML file must follow the DTD http://java.sun.com/j2ee/dtds/web-app_ 2_2.dtd. The ias-web.xml consists of servlets with global unique identifiers  (GUIDs), session information, resource reference information etc.  This XML file must follow the DTD http://developer.iplanet.com/appserver/dtds/IASWebApp_1_0.dtd. Sun Java System Application Server needs ias-web.xml for registering all the servlets/jsps and use this registry information for Sun Java System Application Server specific features like load balancing, dynamic servlet configuration etc.

Registering Application Components

Deploying Servlets:
All the application servlets must present in both web.xml and ias-web.xml and register with Sun Java System Application Server by specifying a unique global identifier.  These servlets should use sticky load balancing when they are integrating with Access Manager.

A sample web.xml file and ias-web.xml for a servlet registration in a sticky load balancing mode.  Information in the ias-web.xml file can edited using Sun Java System Application Server Administrative tool (ksvradmin).

web.xml:

<?xml version="1.0" ?>
    <!DOCTYPE web-app>
    <web-app>
        <display-name>Sample File</display-name>
        <servlet>
            <servlet-name>SimpleServlet</servlet-name>
            <servlet-class>com.iplanet.samples.SampleServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>SimpleServlet</servlet-name>
            <url-pattern>/simpleservlet</url-pattern>
        </servlet-mapping>
    </web-app>

ias-web.xml:

<?xml version="1.0" ?>
    <ias-web-app>
        <servlet>
            <servlet-name>SimpleServlet</servlet-name>
            <guid>{aaaabbbb-A456-161A-8be4-0800203942f2}</guid>
            <sticky>true</sticky>
        </servlet>
    </ias-web-app>

ias-web.xml and web.xml files can be automatically generated using Sun Java System Application Server deploytool command.  Global Unique identifiers can be generated using kguidgen tool.

Once the application is deployed,  the servlet is accessible from from this URL

http://server:port/NASApp/AppName/simpleservlet

where

NASApp is prefix to let the web server know that this is for Sun Java System Application Server
AppName is the name of the war file.

 

Deploying JSPs

There are two ways to  deploy JSPs on Sun Java System Application Server, unregistered and registered. Unregistered JSPs are deployed by just copying into the corresponding directory structure like an HTML files. They need not mention in web.xml and ias-web.xml files.  Sun Java System Application Server allows  JSPs to be registered with GUIDs with XML file.  This will allow JSPs to use Sun Java System Application Server specific features like load balancing etc.  If the Applications JSPs are Session based and when they integrate with Access Manager,  they should be registered JSPs.

Sample web.xml and ias-web.xml with registered JSPs are as follows:
web.xml:

<?xml version="1.0" ?>
    <!DOCTYPE web-app>
    <web-app>
        <display-name>An Example Registered JSP File </display-name>
        <servlet>
            <servlet-name>JSPExample</servlet-name>
            <jsp-file>JSPExample.jsp</jsp-file>
        </servlet>
        <servlet-mapping>
            <servlet-name>JSPExample</servlet-name>
            <url-pattern>/jspexample</url-pattern>
        </servlet-mapping>
    </web-app>

ias-web.xml:

<?xml version="1.0" ?>
    <ias-web-app>
        <servlet>
            <servlet-name>JSPExample</servlet-name>
            <guid>{aaaabbbb-B456-161A-8be4-0800803942f2}</guid>
            <sticky>true</sticky>
        </servlet>
    </ias-web-app>

This JSP can accessed  by using a URL http://server:port/NASApp/AppName/JSPExample

 

Access Manager Samples

Access Manager supplies a sample war file to deploy onto Sun Java System Application Server.  This war file consists of ias-web.xml file and web.xml file and the compiled servlets/jsps.  This war file can be found under the directory $ISROOT/SUNWam/samples/appserver.  The source code for these samples are also under the same directory.

In order to run these samples, deploy this war file using Sun Java System Application Server deployment tool

$IASBINDIR/iasdeploy deploymodule $ISROOTDIR/SUNWam/samples/appserver/amsamples.war

These samples will describe how to create /display a user and they use a sample servlet and JSP pages to describe the flow
In order to run these samples,  you must log into the Access Manager because they need SSO Token.

To create a user, http://<server:port>/NASApp/amsamples/create.html

To display user attributes, http://<server:port>/NASApp/amsamples/display.html

There's no need of adding Access Manager class files to the CLASSPATH variable  in order to run these samples since we are deploying  Access Manager as a war file and hence Sun Java System Application Server takes care of it.