logo资料库

Experience J2EE! Using WebSphere Application Server V6.1.pdf

第1页 / 共474页
第2页 / 共474页
第3页 / 共474页
第4页 / 共474页
第5页 / 共474页
第6页 / 共474页
第7页 / 共474页
第8页 / 共474页
资料共474页,剩余部分请下载后查看
Front cover
Contents
Notices
Trademarks
Preface
The individual that wrote this redbook
Become a published author
Comments welcome
Summary of changes
February 2008, Second Edition
Part 1 Preliminary activities
Chapter 1. Introduction
1.1 Learn, Experience, Explore!
1.2 J2EE simplified
1.2.1 Objective
1.2.2 Specifications
Changes in J2EE standards
1.2.3 Implementations
1.2.4 Web services and messaging
1.2.5 Container architecture
Client Side Tier
(Not shown above)
Presentation Tier
Business Logic Tier
Back End Tier
1.3 Introduction of the scenario
Donate sample application
1.4 Version 2 updates
Chapter 2. Install and configure software
2.1 Required software
2.2 Hardware requirements
2.3 Obtaining the software
2.4 Supported operating systems
2.4.1 Windows operating system considerations
2.4.2 Linux operating system considerations
2.5 Install the base WebSphere Application Server Toolkit V6.1.1
2.6 Install fixes for WebSphere Application Server Toolkit V6.1.1
2.7 Install WebSphere Application Server V6.1 (base)
2.7.1 Disable the WebSphere Application Server automatic startup for Windows
2.8 Install fixes for WebSphere Application Server V6.1
2.8.1 Install the Update Installer
2.8.2 Install the Java SDK Fix Pack
2.8.3 Install the AppServer Fix Pack
Chapter 3. Configure the development environment
3.1 Learn!
3.2 Extract the ExperienceJ2EE.zip samples file
3.3 Create the AST V6.1 workspace
3.4 Configure the WAS V6.1 server runtime definition
3.5 Create the ExperienceJ2EE application server profile
3.6 Create the ExperienceJ2EE Server @ localhost test server definition
3.7 Start the ExperienceJ2EE test server
3.8 Import the sample code snippets
3.9 Explore!
Chapter 4. Prepare the legacy application
4.1 Learn!
4.2 Create the Vacation application database
4.3 Create the Vacation application database tables
4.4 Populate the Vacation application database
4.5 Explore!
Part 2 Core J2EE application
Chapter 5. Create the employee data access element
5.1 Learn!
5.2 Create the enterprise application project
5.3 Develop the Employee entity EJB
5.3.1 Generate the entity EJB from the Vacation database
5.3.2 Set the Default CMP connection factory JNDI name
5.3.3 Generate the deployment code
5.3.4 Alter the workspace settings to ignore unused methods
5.4 Configure the test server for DonateEJB
5.4.1 Start the admin console
5.4.2 Create the ExperienceJ2EE JAAS authentication alias
5.4.3 Create the Derby XA JDBC provider
5.4.4 Create the Vacation JDBC data source
5.5 Add the DonateEAR application to the test server
5.6 Test the Employee entity EJB with the Universal Test Client
5.6.1 Start the UTC
5.6.2 Specify the Admin user ID
5.6.3 Test the Employee entity EJB with the UTC
5.7 Explore!
Chapter 6. Create the funds data access element
6.1 Learn!
6.2 Create the new EJB project
6.3 Develop the Funds entity EJB
6.3.1 Define the Funds entity EJB
6.3.2 Map the Funds entity EJB to a database
6.3.3 Set the Default CMP connection factory JNDI name
6.3.4 Generate the deployment code
6.3.5 Alter the workspace settings to ignore specific warnings
6.4 Create the Funds database and tables
6.4.1 Create the Funds database
6.4.2 Create the Funds tables
6.5 Configure the test server for DonateEJB2
6.5.1 Verify that the ExperienceJ2EE JAAS authentication alias exists
6.5.2 Verify that the Derby (XA) provider already exists
6.5.3 Create the Funds JDBC Data source
6.6 Add DonateEJB2 to DonateEAR
6.7 Test the Funds entity EJB with the UTC
6.7.1 Restart the UTC
6.7.2 Test the Funds entity EJB with the UTC
6.8 Explore!
Chapter 7. Create the donate business logic element
7.1 Learn!
7.2 Define the Donate session EJB
7.2.1 Alter the workspace settings to ignore warnings
7.2.2 Create the EJB references
7.3 Code the Donate session EJB
7.3.1 Create the donateVacation method
7.3.2 Add the call to the Employee entity EJB using a snippet
7.3.3 Add the call to the Funds entity EJB using a snippet
7.3.4 Complete the session EJB
7.4 Test the Donate session EJB with the UTC
7.5 Explore!
Chapter 8. Create the employee facade business logic element
8.1 Learn!
8.2 Define the EmployeeFacade session EJB
8.2.1 Create the EJB reference
8.3 Code the EmployeeFacade session EJB
8.3.1 Create the Employee JavaBean
8.3.2 Create the getEmployeeByKey method
8.4 Test the EmployeeFacade session EJB with the UTC
8.5 Explore!
Chapter 9. Create the Web front end
9.1 Learn!
9.2 Create/Configure the Web project
9.2.1 Create the Web project
9.2.2 Configure the Web project
9.3 Develop the DonateWebRecord JavaBean
9.3.1 Create the EJB references
9.3.2 Create the base class
9.3.3 Code the processEmployee method
9.3.4 Code the processDonation method
9.3.5 Work around: Add serviceLocatorMgr.jar to MANIFEST.MF
9.4 Create and test the Web pages
9.4.1 Create the JSP pages
9.4.2 Complete and test enterEmployee.jsp
9.4.3 Complete and test employeeDetail.jsp
9.4.4 Complete and test donateResult.jsp
9.5 Explore!
Resources
Chapter 10. Create the application client
10.1 Learn!
10.2 Create the application client project
10.3 Create the EJB reference
10.4 Code the main method
10.5 Test the application client
10.6 Explore!
Chapter 11. Implement core security
11.1 Learn!
11.1.1 User registry
11.1.2 Application role based security
11.1.3 Administrative security
11.2 Preliminary security setup
11.2.1 Create and configure the Jython project and script
11.2.2 Run the Jython script
11.3 Enable J2EE application security
11.3.1 Enable J2EE application security
11.3.2 Restart the ExperienceJ2EE Server @ localhost test server
11.4 Implement declarative security
11.4.1 Restrict access to Web pages via declarative security
11.4.2 Restrict access to Donate session EJB via declarative security
11.4.3 Update the EJB method permissions to apply to all interfaces
11.4.4 Update the EAR by gathering roles and assigning users
11.4.5 Test declarative security
11.5 Implement programmatic security
11.5.1 Implement programmatic security in EmployeeFacade
11.5.2 Test programmatic security in the EmployeeFacade session EJB
11.5.3 Implement programmatic security in DonateWeb
11.5.4 Test programmatic security in DonateWeb
11.6 Update the J2EE application client for security
11.6.1 Create a customized properties file
11.6.2 Update and test the J2EE application client test configuration
11.7 Disable J2EE application security
11.7.1 Disable J2EE application security
11.7.2 Restart the ExperienceJ2EE Server @ localhost test server
11.8 Explore!
Chapter 12. Alternative Import the core J2EE application
12.1 Preliminary activities
12.2 Import the sample application
12.3 Configure the sample application
Part 3 Web services
Chapter 13. Create the Web service
13.1 Learn!
13.1.1 Web services and J2EE 1.4
13.2 Create the EJB based Web service
13.3 Modify the WSDL to remove HTTPS
13.4 Test the Web service using the Web Services Explorer
13.5 Create and test a Web service client
13.5.1 Create a new enterprise application project
13.5.2 Create and test the Web service client
13.6 Explore!
Chapter 14. Implement security for the Web service
14.1 Learn!
14.2 Re-enable J2EE application security
14.2.1 Re-enable J2EE application security
14.2.2 Restart the ExperienceJ2EE Server @ localhost test server
14.3 Test the unsecured Web service
14.4 Update the Web service client to support secure access
14.5 Update the Web service to support secure access
14.6 Test the secure Web service
14.7 Disable J2EE application security
14.8 Explore!
Part 4 Messaging
Chapter 15. Create the message-driven bean
15.1 Learn!
15.1.1 Service integration bus
15.2 Configure the test server for base JMS resources
15.2.1 Create the Service Integration Bus
15.2.2 Configure security
15.2.3 Create the destination queue resource
15.2.4 Create the JMS queue destination
15.2.5 Create the JMS activation specification
15.2.6 Create the JMS connection factory for the application client
15.2.7 Restart the ExperienceJ2EE Server @ localhost test server
15.3 Create the message-driven bean
15.3.1 Define the MDB
15.3.2 Add the activation specification information
15.3.3 Create the EJB reference
15.3.4 Code the DonateMDB message-driven bean
15.4 Create the messaging client (DonateMDBClient)
15.5 Test the messaging client
15.6 Explore!
Chapter 16. Add publication of results
16.1 Learn!
16.2 Update the Donate session EJB
16.3 Create the messaging pub sub client (DonatePubSubClient)
16.4 Test the messaging pub sub client
16.4.1 Start DonatePubSubClient
16.4.2 Submit requests
16.5 Explore!
Chapter 17. Implement security for messaging
17.1 Learn!
17.2 Re-enable J2EE application security
17.3 Test the messaging artifacts as-is
17.4 Update DonateMDBClient and DonateMDB
17.4.1 Update the DonateMDBClient code
17.4.2 Update the DonateMDB code
17.5 Test the updated messaging artifacts
17.6 Disable J2EE application security-Optional
17.7 Explore!
Chapter 18. What next?
18.1 developerWorks, alphaWorks, and Google
18.2 Rational Application Developer
18.3 Asynchronous JavaScript and XML
18.4 Portals
18.5 Java EE 5
18.5.1 Java EE 5: JavaServer Faces
18.5.2 Java EE 5: Enterprise JavaBeans V3.0
18.5.3 Java EE 5: Web services support
18.6 Enterprise Service Buses
18.7 Business Process Execution Language
18.8 Service Oriented Architecture
Part 5 Appendixes
Appendix A. Additional material
Locating the Web material
Using the Web material
System requirements for downloading the Web material
How to use the Web material
Related publications
IBM Redbooks
Online resources
How to get IBM Redbooks
Help from IBM
Abbreviations and acronyms
Index
Back cover
Front cover Experience J2EE! Using WebSphere Application Server V6.1 Including Web services and messaging Using the Application Server Toolkit Using the Derby database Charles P. Brown ibm.com/redbooks
International Technical Support Organization Experience J2EE! Using WebSphere Application Server V6.1 February 2008 SG24-7297-01
Note: Before using this information and the product it supports, read the information in “Notices” on page xi. Second Edition (February 2008) This edition applies to Version 6.1.1 of WebSphere Application Server and the Application Server Toolkit. © Copyright International Business Machines Corporation 2007, 2008. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
Contents Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii The individual that wrote this redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Summary of changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii February 2008, Second Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Part 1. Preliminary activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 Learn, Experience, Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 J2EE simplified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2.1 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2.2 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.2.3 Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2.4 Web services and messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2.5 Container architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.3 Introduction of the scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.4 Version 2 updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Chapter 2. Install and configure software. . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.1 Required software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.2 Hardware requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.3 Obtaining the software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.4 Supported operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.4.1 Windows operating system considerations . . . . . . . . . . . . . . . . . . . . 32 2.4.2 Linux operating system considerations . . . . . . . . . . . . . . . . . . . . . . . 33 2.5 Install the base WebSphere Application Server Toolkit V6.1.1 . . . . . . . . . 36 2.6 Install fixes for WebSphere Application Server Toolkit V6.1.1 . . . . . . . . . 37 2.7 Install WebSphere Application Server V6.1 (base) . . . . . . . . . . . . . . . . . . 39 2.7.1 Disable the WebSphere Application Server automatic startup for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.8 Install fixes for WebSphere Application Server V6.1. . . . . . . . . . . . . . . . . 41 2.8.1 Install the Update Installer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.8.2 Install the Java SDK Fix Pack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 © Copyright IBM Corp. 2007, 2008. All rights reserved. iii
2.8.3 Install the AppServer Fix Pack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Chapter 3. Configure the development environment . . . . . . . . . . . . . . . . . 47 3.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.2 Extract the ExperienceJ2EE.zip samples file . . . . . . . . . . . . . . . . . . . . . . 50 3.3 Create the AST V6.1 workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 3.4 Configure the WAS V6.1 server runtime definition . . . . . . . . . . . . . . . . . . 55 3.5 Create the ExperienceJ2EE application server profile . . . . . . . . . . . . . . . 58 3.6 Create the ExperienceJ2EE Server @ localhost test server definition . . . 65 3.7 Start the ExperienceJ2EE test server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.8 Import the sample code snippets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 3.9 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Chapter 4. Prepare the legacy application . . . . . . . . . . . . . . . . . . . . . . . . . 79 4.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4.2 Create the Vacation application database. . . . . . . . . . . . . . . . . . . . . . . . . 80 4.3 Create the Vacation application database tables . . . . . . . . . . . . . . . . . . . 83 4.4 Populate the Vacation application database . . . . . . . . . . . . . . . . . . . . . . . 87 4.5 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Part 2. Core J2EE application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Chapter 5. Create the employee data access element. . . . . . . . . . . . . . . . 93 5.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 5.2 Create the enterprise application project. . . . . . . . . . . . . . . . . . . . . . . . . . 98 5.3 Develop the Employee entity EJB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 5.3.1 Generate the entity EJB from the Vacation database . . . . . . . . . . . 104 5.3.2 Set the Default CMP connection factory JNDI name . . . . . . . . . . . 109 5.3.3 Generate the deployment code. . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 5.3.4 Alter the workspace settings to ignore unused methods. . . . . . . . . 112 5.4 Configure the test server for DonateEJB. . . . . . . . . . . . . . . . . . . . . . . . . 113 5.4.1 Start the admin console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 5.4.2 Create the ExperienceJ2EE JAAS authentication alias . . . . . . . . . 116 5.4.3 Create the Derby XA JDBC provider. . . . . . . . . . . . . . . . . . . . . . . . 118 5.4.4 Create the Vacation JDBC data source . . . . . . . . . . . . . . . . . . . . . 121 5.5 Add the DonateEAR application to the test server . . . . . . . . . . . . . . . . . 127 5.6 Test the Employee entity EJB with the Universal Test Client . . . . . . . . . 131 5.6.1 Start the UTC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 5.6.2 Specify the Admin user ID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 5.6.3 Test the Employee entity EJB with the UTC . . . . . . . . . . . . . . . . . . 136 5.7 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Chapter 6. Create the funds data access element . . . . . . . . . . . . . . . . . . 145 6.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 iv Experience J2EE! Using WebSphere Application Server V6.1
6.2 Create the new EJB project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 6.3 Develop the Funds entity EJB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 6.3.1 Define the Funds entity EJB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 6.3.2 Map the Funds entity EJB to a database . . . . . . . . . . . . . . . . . . . . 153 6.3.3 Set the Default CMP connection factory JNDI name . . . . . . . . . . . 157 6.3.4 Generate the deployment code. . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 6.3.5 Alter the workspace settings to ignore specific warnings . . . . . . . . 158 6.4 Create the Funds database and tables . . . . . . . . . . . . . . . . . . . . . . . . . . 158 6.4.1 Create the Funds database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 6.4.2 Create the Funds tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 6.5 Configure the test server for DonateEJB2. . . . . . . . . . . . . . . . . . . . . . . . 162 6.5.1 Verify that the ExperienceJ2EE JAAS authentication alias exists . 162 6.5.2 Verify that the Derby (XA) provider already exists . . . . . . . . . . . . . 163 6.5.3 Create the Funds JDBC Data source . . . . . . . . . . . . . . . . . . . . . . . 164 6.6 Add DonateEJB2 to DonateEAR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 6.7 Test the Funds entity EJB with the UTC . . . . . . . . . . . . . . . . . . . . . . . . . 168 6.7.1 Restart the UTC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 6.7.2 Test the Funds entity EJB with the UTC . . . . . . . . . . . . . . . . . . . . . 169 6.8 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Chapter 7. Create the donate business logic element. . . . . . . . . . . . . . . 175 7.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 7.2 Define the Donate session EJB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 7.2.1 Alter the workspace settings to ignore warnings. . . . . . . . . . . . . . . 180 7.2.2 Create the EJB references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 7.3 Code the Donate session EJB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 7.3.1 Create the donateVacation method . . . . . . . . . . . . . . . . . . . . . . . . 186 7.3.2 Add the call to the Employee entity EJB using a snippet . . . . . . . . 191 7.3.3 Add the call to the Funds entity EJB using a snippet . . . . . . . . . . . 194 7.3.4 Complete the session EJB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 7.4 Test the Donate session EJB with the UTC . . . . . . . . . . . . . . . . . . . . . . 196 7.5 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Chapter 8. Create the employee facade business logic element . . . . . . 203 8.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 8.2 Define the EmployeeFacade session EJB . . . . . . . . . . . . . . . . . . . . . . . 206 8.2.1 Create the EJB reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 8.3 Code the EmployeeFacade session EJB . . . . . . . . . . . . . . . . . . . . . . . . 207 8.3.1 Create the Employee JavaBean . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 8.3.2 Create the getEmployeeByKey method . . . . . . . . . . . . . . . . . . . . . 210 8.4 Test the EmployeeFacade session EJB with the UTC . . . . . . . . . . . . . . 214 8.5 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Chapter 9. Create the Web front end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Contents v
9.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 9.2 Create/Configure the Web project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 9.2.1 Create the Web project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 9.2.2 Configure the Web project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 9.3 Develop the DonateWebRecord JavaBean. . . . . . . . . . . . . . . . . . . . . . . 227 9.3.1 Create the EJB references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 9.3.2 Create the base class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 9.3.3 Code the processEmployee method . . . . . . . . . . . . . . . . . . . . . . . . 232 9.3.4 Code the processDonation method. . . . . . . . . . . . . . . . . . . . . . . . . 235 9.3.5 Work around: Add serviceLocatorMgr.jar to MANIFEST.MF . . . . . 236 9.4 Create and test the Web pages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 9.4.1 Create the JSP pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 9.4.2 Complete and test enterEmployee.jsp . . . . . . . . . . . . . . . . . . . . . . 239 9.4.3 Complete and test employeeDetail.jsp . . . . . . . . . . . . . . . . . . . . . . 242 9.4.4 Complete and test donateResult.jsp . . . . . . . . . . . . . . . . . . . . . . . . 247 9.5 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Chapter 10. Create the application client . . . . . . . . . . . . . . . . . . . . . . . . . 253 10.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 10.2 Create the application client project . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 10.3 Create the EJB reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 10.4 Code the main method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 10.5 Test the application client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 10.6 Explore! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Chapter 11. Implement core security . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 11.1 Learn! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 11.1.1 User registry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 11.1.2 Application role based security . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 11.1.3 Administrative security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 11.2 Preliminary security setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 11.2.1 Create and configure the Jython project and script. . . . . . . . . . . . 269 11.2.2 Run the Jython script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 11.3 Enable J2EE application security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 11.3.1 Enable J2EE application security . . . . . . . . . . . . . . . . . . . . . . . . . 274 11.3.2 Restart the ExperienceJ2EE Server @ localhost test server . . . . 275 11.4 Implement declarative security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 11.4.1 Restrict access to Web pages via declarative security . . . . . . . . . 275 11.4.2 Restrict access to Donate session EJB via declarative security . . 279 11.4.3 Update the EJB method permissions to apply to all interfaces . . . 282 11.4.4 Update the EAR by gathering roles and assigning users . . . . . . . 284 11.4.5 Test declarative security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 11.5 Implement programmatic security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 vi Experience J2EE! Using WebSphere Application Server V6.1
分享到:
收藏