10.2 Importing a protected servlet application

 < Day Day Up > 

In this section, you will import a previously created Treasure servlet. This servlet will be the back-end secure resource you will access using Credential Vault. The servlet displays a simple image and is only accessible via HTTP basic authentication.

The Treasure servlet application is in c:\LabFiles\CredentialVault\SecureServlet\CredentialVault_TreasureWeb.war.

Note : The sample scenario included in this chapter requires that you download the sample code available as additional materials. See Appendix C, "Additional material" on page 543.

Follow these steps to import the secure servlet:

  1. If required, start WebSphere Studio Site Developer.

  2. Switch to the Web perspective.

  3. From the main menu, select File -> Import... .

  4. Select WAR file and click Next .

    Figure 10-5. Importing a WAR file

    graphics/10fig05.jpg

  5. Browse to the location of the TreasureWeb.war file in c:\LabFiles\CredentialVault\SecureServlet\CredentialVault_TreasureWeb.war.

    Note : The sample scenario included in this chapter requires that you download the sample code available as additional materials. See Appendix C, "Additional material" on page 543.

  6. Enter a new Web project name of TreasureWeb and a new enterprise project name of TreasureEAR .

    Figure 10-6. Import the Treasure WAR file

    graphics/10fig06.jpg

  7. Click Finish to import the application (secure servlet WAR file).

After importing the WAR file, a new Web and enterprise project exist in your project. Now you can test the servlet to check that it is running properly.

To test the servlet, proceed as follows :

  1. In the J2EE Navigator view, expand the TreasureWeb/Java Source/treasure package.

  2. Right-click TreasurePage.java and select Run on server ... from the context menu.

  3. Click OK to create a new server using Test Environment and wait for a few minutes until the portal starts for e-business and the servlet is executed.

    Note : If you are not prompted to create a new server, you can always create a new server as follows:

    1. In the Server Selection dialog, click Advanced... .

    2. In the Advanced Server Selection dialog, check Create a New Server and select WebSphere Version 5.0 Test Environment as the server type. Click Finish . This is illustrated in Figure 10-7.

      Figure 10-7. Select a WebSphere V5.0 Test Environment to run the servlet

      graphics/10fig07.gif

    Note : Because you are only using the Web container of the application server, you can also select a WebSphere Version 5.0 Express Test Environment if it is available.

  4. The internal Web browser opens. Because this servlet is secured, you have to enter a user name and password. Enter user1 as the user name and password1 as the password.

    Figure 10-8. Basic authentication

    graphics/10fig08.jpg

  5. Click OK . Now the browser should show the treasure servlet. See Figure 10-9.

    Figure 10-9. Running the secured servlet

    graphics/10fig09.jpg

  6. From the Servers view on the bottom of WebSphere Studio, select the WebSphere V5 Test Environment server and click the red Stop button to stop the server.

 < Day Day Up > 


IBM WebSphere Portal V5 A Guide for Portlet Application Development
IBM Websphere Portal V5: A Guide for Portlet Application Development
ISBN: 0738498513
EAN: 2147483647
Year: 2004
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net