For WebSphere Application Server (WAS) V9, available on IBM Bluemix, there are some downloadable Java EE 7 sample applications that allow you to explore some selected Java EE 7 technologies. You will deploy the samples for yourself, and will find the samples on GitHub. These applications run on both WAS V9 and on Liberty (which already supports the Java EE 7 Full Platform). Let’s take a closer look at these samples.
What are the Java EE 7 samples?
Here’s a quick overview of the selected Java EE 7 samples:
- shows how to set up WebSocket endpoints using annotations or programmatically
- exercises opening, reading from, writing to, and closing a WebSocket connection
- demonstrates the use of encoders, decoders, the PathParam annotation, and Pong message processing
- shows how to use some of the new Expression Language (EL 3.0) functions
- demonstrates a use of lambda expressions, concatenation, and new operators
- provides a simple sample of a stand-alone servlet that shows EL in use without JavaServer Pages (JSP)
- demonstrates how to use non-blocking I/O by using new APIs added to ServletInputStream and ServletOutputStream
- explores the usage of the ReadListener and WriteListener interface APIs
- exercises the JSR 352 batch implementation
- provides a sample of a batchlet and one batch job that sleeps for a user-defined number of seconds
- uses a web interface wrapped around the batch application to provide an easier access to the batch functions
- provides five servlets that parse and display data based on different implementations for processing JSON code
- uses a web interface designed to provide an easier access to JSON-P functions
- uses the simplified API of JMS 2.0
- contains two servlets for performing Point to Point and Publish/Subscribe messaging
- provides an example how to send or receive messages to a queue and also to publish and subscribe messages from a topic
You can find the source code for the samples on GitHub, which you can download, deploy and run.
Downloading and deploying the samples to WAS on the cloud
To download and deploy the Java EE 7 samples to WAS on the cloud:
- Download the source code for a sample from GitHub and build your application using a Liberty server. The following articles describe how to use Maven to download and build the sample depending on whether you prefer to work from the command line or from within Eclipse:
- Most sample applications can be deployed without any further preparation but sample.javaee7.sleepybatchlet and sample.javaee7.jms require resources to be created before you attempt to deploy application on WAS in the cloud. Check the README.md files for each of those samples for detailed instructions.
- To deploy to WAS (whether in the cloud or on a local installation), you have two options:
- Using the graphical WAS administrative console
Deploying using wsadmin
- Navigate to your
bindirectory of your WAS installation. For example :
- Run the following command:
./wsadmin.sh -profileName AppSrv01 -lang jython -c "AdminApp.install('/opt/sample_name.war', '[ -MapWebModToVH [[ .* .* default_host ]] -appname sample_name]')"
Deploying using the WAS administrative console
- In your web browser, go to the WAS administrative console; for example:
- Log in with your user name and password.
- Click Applications > New Application.
- Select the New Enterprise Application link.
- Using the Local file system option, click Browse, and select the
.warfile that you built using Maven earlier.
- Click Next to follow the wizard using the default options until the Finish button is displayed.
- When the Confirm changes section is displayed, click Save.
- Click Applications > Application Types > WebSphere enterprise applications.
- Select the check box next to the sample application, and click Start.
- Use your browser to access application home page; for example: