Installation of Sample Application
CourierApp Sample
Follow the steps in this section to locate and install the CourierApp Sample application on WebSphere® Application Server Version 6.1.x.
If <install_root> is the directory where the feature pack is installed in the case of WebSphere Application Server (for example,
the directory where WebSphere Application Server is installed) and <WASCEFEP_HOME> is the directory
where IBM WebSphere Application Server Community Edition Version 2.0 Plug-in for Web 2.0 Version 1.0 is unzipped.
- Locating the stand-alone sample:
The CourierApp sample for the RPC adapter library included in the IBM® WebSphere Application Server Feature Pack for Web 2.0 is located
in the <install_root>/web2fep/samples/RPCAdapter/CourierApp.war directory when installed for WebSphere Application Server v6.1.x .
The Helloworld sample is located at <install_root>/web2fep/samples/RPCAdapter/HelloWorld.ear directory.
Importing the CourierApp sample into an Eclipse-based IDE:
- From the Eclipse IDE menu, select File > Import.
- In the presented panel, expand the Web option, select WAR file, and click Next.
- In the WAR File entry field, click Browse, and select the WAR file you located earlier.
- Ensure the Add Project to an EAR check box is unchecked.
- Accept defaults for the project name, if they are acceptable, and click Next.
- Click Finish. This imports the sample application as a Web project in Eclipse.
When the import process completes, a new project exists in the Eclipse Project Explorer: CourierApp from which the application source code can be accessed.
Importing the HelloWorld sample into an Eclipse-based IDE:
- From the Eclipse IDE menu, select File > Import.
- In the presented panel, expand the JavaTM EE option, select EAR file, and click Next.
- In the EAR File entry field, click Browse, and select the EAR file you located earlier. This action populates the other two fields.
- Accept defaults for the project name. If they are acceptable, click Next.
- Click Finish. This imports the sample application as an Enterprise application project in Eclipse.
When the import process completes, three new projects exist in the Eclipse Project Explorer: HelloWorldEJB, HelloWorldWAR and HelloWorld.
The application source code can be accessed from the HelloWorldEJB project.
Installing the sample on WebSphere Application Server V6.1.x
- Start the server and log into the administrative console.
- From the navigation pane, click the Install New Application link under Applications section.
- Browse to the location of the CourierApp.war file. Enter Context Root as CourierApp.
- Click Next > Next > Continue. (Some of these steps might not be applicable for WebSphere Application Server Version 6.1.)
- Click Next until Summary page is displayed and click Finish.
- The resulting page contains a link 'Save to Master Configuration'. Click this link and click Save in the page that comes up.
- Click Enterprise Applications link under the Applications section.
- Select the application and click Start to start the sample application.
- Browse to http://localhost:9080/CourierApp to bring up the welcome page.
Note: The host name and ports might vary according to your server configuration.
HelloWorld Sample
The steps to install HelloWorld sample application is same as CourierApp. Follow the instructions previously mentioned to install and deploy the application.
There is no need for the specification of a context root in this case. Browse to http://localhost:9080/helloworld to bring up welcome page of sample.
The Context root is helloworld
.
Note: The host name and ports might vary according to your server configuration.
Securing the CourierApp Sample application
Complete the following steps to implement J2EE security in the CourierApp Sample application on WebSphere Application Server Version 6.1.x.
Also, complete the following steps to enable security for the sample.
WebSphere Application Server V6.1.x
To test Courier application (with security enabled), do the following steps:
- Ensure that administrative security for the server on which the application is deployed is enabled.
- To verify the security is enabled properly, access administrative console and this should prompt for user name and password.
- Log onto the administrative console using a valid user name and password.
- Navigate to Applications > Enterprise Applications > CourierApp_war > Security role to user/group mapping.
- Select the role to map the users.
There are three possibilities:
- Everyone : Select this option to allow everyone to access this role.
- All Authenticated : Select this option to allow anyone with proper credentials.
- Look up Users : Select users that are explicitly mapped to the role.
After mapping the users to the roles, click on ok.
- Save the configuration.
- Restart server/application.
- The sample with security turned on will provide an authentication screen when the first Web remoting call to the server is made.
- In order to test the role based authentication feature, use the <role> tag in the RpcAdapterConfig.xml file to specify access to any service.
If access is granted to a role other than one that is authenticated in the previous step, RPC adapter might deny access to the corresponding service and return an
"Invalid Access" error. In the examples shown previously, only the "non-Admin" role has access to the DestinationLookup service. If the user has not been authenticated
or has been authenticated in a different role, access to this service is denied by the RPC adapter.
DestinationLookup
non-Admin
com.ibm.courier.DestinationLookup
getDestination
get destination
GET
destinationId
A snap shot of web.xml that shows the url '/RPCAdapter/*' is secured is shown below. To access the methods in this pattern, one has to pass the correct credentials.
BASIC
Sample Security Realm
admin
administrator
Protection area for RPCAdapter Servlet.
/RPCAdapter/*
GET
POST
RPCAdapter Servlet Security:+:All Authenticated users for RPCAdapter Servlet.
admin
NONE
Note: The host name and ports might vary according to your server configuration.