Use this task to set the ActivitySession deployment attributes
for a Web application to start UserActivitySessions and perform work
scoped within ActivitySessions.
Before you begin
This task assumes that you have an Enterprise Archive (EAR)
file that contains an application enterprise bean that can be deployed
in WebSphere® Application Server. For more
details, see the topic about assembling applications.
About this task
You can configure the deployment attributes of an application
by using an assembly tool. This topic describes the use of Rational® Application
Developer to configure the deployment attributes.
To set the
ActivitySession deployment attributes for a Web application, complete
the following steps:
Procedure
- Start the assembly tool. For more information,
refer to the Rational Application Developer information.
- Create or edit the Web module. For example,
to change attributes of an existing module, click ,
then select the archive file for the module. For example,
to change attributes of an existing module, use the Import wizard
to import the EAR or WAR file into the assembly tool. To start the
Import wizard:
- Click .
- Expand the Web folder, click WAR file,
then click Next.
- Select the WAR file, then click Finish.
- In the Project Explorer view of the Java EE perspective,
right-click the component instance, right-click Deployment
Descriptor Editor, then click Open With . A property dialog notebook for the Web module is displayed
in the property pane.
- In the property pane, select the Extended services tab.
- Select the servlet that you want to change.
- In the ActivitySession section, set the ActivitySession
control kind attribute to Application, Container, or None.
- Application
- The Web application is responsible for starting and ending ActivitySessions,
as follows:
- If an HttpSession is active when an application begins an ActivitySession,
the container associates the ActivitySession with the HttpSession.
- If an ActivitySession is started in the absence of an HttpSession,
the application must ensure it is completed before the dispatched
method completes; otherwise, an exception results.
- If an HttpSession is associated with a request dispatched to an
application with this ActivitySession control value, and if that HttpSession
has an ActivitySession associated with it, the container dispatches
the request in the context of that ActivitySession. For example, the
container resumes the ActivitySession context onto the thread before
the dispatch.
- A Web application can use both transactions and ActivitySessions.
Any transactions started within the scope of an ActivitySession must
be ended by the Web component that started them and within the same
request dispatch.
- Container
- A servlet has no access to UserActivitySessions. Any HttpSession
started by the servlet has an ActivitySession automatically associated
with it by the container, and this ActivitySession is put onto the
thread of execution. If such a servlet is dispatched by a request
that has an HttpSession containing no ActivitySession, then the container
starts an ActivitySession and associates it with the HttpSession and
the thread.
A Web application can use both transactions and ActivitySessions.
Any transactions started within the scope of an ActivitySession must
be ended by the Web component that started them and within the same
request dispatch.
- None
- A servlet has no access to UserActivitySession. An HttpSession
started by the servlet does not have an ActivitySession automatically
associated with it by the container. If such a servlet is dispatched
by a request that has an HttpSession containing an ActivitySession,
then the container dispatches the request in the context of that ActivitySession.
For example, the container resumes the ActivitySession context onto
the thread before the dispatch.
- To apply the changes and close the assembly tool, click OK.
Otherwise, to apply the values but keep the property dialog open for
additional edits, click Apply.
- Save your changes to the deployment descriptor.
- Close the deployment descriptor editor.
- When prompted, click Yes to save
changes to the deployment descriptor.
- Verify the archive files. For more information
about verifying files using Rational Application Developer,
refer to the Rational Application Developer information.
- From the popup menu of the project, click Deploy to
generate EJB deployment code.
- Optional: Test your completed module on a WebSphere Application Server installation.
Right-click a module, click Run on Server,
and follow the instructions in the displayed wizard.
Important: Use Run On Server for unit
testing only. The assembly tool controls the WebSphere Application
Server installation and, when an application is published remotely,
the assembly tool overwrites the server configuration file for that
server. Do not use the Run On Server option
on production servers.
What to do next
After assembling your application, use a systems management
tool to deploy the WAR file. For example, to use the administrative
console, see the topic about deploying and administering enterprise
applications.