+

Search Tips   |   Advanced Search

Set Web module ActivitySession deployment attributes

Use this task to set the ActivitySession deployment attributes for a Web application to start UserActivitySessions and perform work scoped within ActivitySessions.

This task assumes that we have an EAR file containing an application enterprise bean that can be deployed in WebSphere Application Server. For more details, see the topic about assembling applications.

We 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...

  1. Start the assembly tool. For more information, refer to the Rational Application Developer information.

  2. Create or edit the Web module. For example, to change attributes of an existing module, click File > Open, 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:

    1. Click File > Import.

    2. Expand the Web folder, click WAR file, then click Next.

    3. Select the WAR file, then click Finish.

  3. 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.

  4. In the property pane, select the Extended services tab.

  5. Select the servlet to change.

  6. 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.

  7. 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.

  8. Save the changes to the deployment descriptor.

    1. Close the deployment descriptor editor.

    2. When prompted, click Yes to save changes to the deployment descriptor.

  9. Verify the archive files. For more information about verifying files using Rational Application Developer, refer to the Rational Application Developer information.

  10. From the popup menu of the project, click Deploy to generate EJB deployment code.

  11. Optional: Test the completed module on a WAS 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 WAS 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 the 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.


Related concepts

  • The ActivitySession service
  • Development and assembly tools


    Related tasks

  • Assembling applications
  • Deploy


    Related information: