Installation of Sample Application
CourierApp Sample
Follow the steps in this section to locate and install the CourierApp Sample application on WebSphere® Application Server Community Edition
Version 2.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 <WASCEFEP_HOME>/RPCAdapterSamples/samples/CourierApp.war directory when installed for WebSphere Application Server Community
Edition v2.x. The Helloworld sample is located at the <WASCEFEP_HOME>/RPCAdapterSamples/samples/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, and click Next.
- Click Finish. This imports the sample application as a 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 Community Edition 2.x:
- Start WebSphere Application Server Community Edition 2.x.
- Open browser and navigate to http://localhost:8080/console.
- Enter user name as system and password as manager and log in.
- In the navigation, click the Deploy New link.
- Browse to the directory where the sample is extracted and select sample in Archive.
- Click Install. This deploys the Application.
- Browse to http://localhost:8080/CourierApp to brink 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:8080/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
Follow the steps in this section to to implement J2EE security in the CourierApp Sample application on IBM WebSphere Application Server Community Edition 2.x.
Also, follow the steps to enable security for the sample.
- The sample uses the default security realm (geronimo-admin), all the security related mappings should be done under the web.xml and geronimo-web.xml files.
- A snap shot of the geronimo-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.
- The sample asks for authentication when the first Web remoting call to the server is made. The user name and password expected is the same as that for default administrative
console login(system and manager).
- In order to test the role based authentication feature, use the <role> tag in the 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 denies access to the corresponding service and return an "Invalid Access" error.
In the examples shown ahead, 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, then 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 the geronimo-web.xml file that defines the "admin" role is shown below.
geronimo-admin
Note: The host name and ports might vary according to your server configuration.