This application demonstrates how to use non-blocking I/O by using new APIs added to ServletInputStream and ServletOutputStream.
The example includes usage of ReadListener and WriteListener interface APIs.
Browse the code to see what it does, or build and run it yourself.
- Download and install Eclipse with the WebSphere Developer Tools.
- Create a new Liberty Profile Server.
- Clone this repository.
- Import the sample into Eclipse using File -> Import -> Maven -> Existing Maven Projects option.
- Deploy the sample into Liberty server. Right click on the project and select Run As -> Run on Server option. Find and select the Liberty profile server and press Finish.
- Go to: http://localhost:9080/sample.javaee7.servlet.nonblocking/
This project can be build with Apache Maven. The project uses [Liberty Maven Plug-in][] to automatically download and install Liberty profile runtime from the Liberty repository. Liberty Maven Plug-in is also used to create, configure, and run the application on the Liberty server.
Use the following steps to run the application with Maven:
-
Execute full Maven build. This will cause Liberty Maven Plug-in to download and install Liberty profile server.
$ mvn clean install
-
To run the server with the Servlet Non-Blocking application execute:
$ mvn liberty:run-server
Once the server is running, the application will be available under http://localhost:9080/sample.javaee7.servlet.nonblocking/.
Click the button below to deploy your own copy of this application to Bluemix.
Once the application is deployed and running in bluemix, it will be available under http://MYAPPNAME.mybluemix.net/sample.javaee7.servlet.nonblocking/.