WebSphere Everyplace Deployment (hereafter called Everyplace Deployment) is a client middleware framework and tooling platform that enables connection, independent delivery, and management of applications and services. Everyplace Deployment extends the WebSphere programming model by providing J2EE services and Web services to clients, so you can move key components of your applications to the client. The client accesses enterprise data maintained on the server using standard APIs and services. Users benefit from improved application response time because applications perform business operations locally on the client. As a result, network traffic may be reduced between clients and servers. Mobile users can continue to use their applications even when they don't have network connectivity.
Everyplace Deployment provides a development environment in which you can develop workforce mobility applications. You can start small and simple and later begin to deploy a robust set of mobile applications.
To get the most from this article, you should be familiar with Java and Java 2 Platform, Enterprise Edition (J2EE), as well as plug-in development using Eclipse 3.x technology.
You'll perform the following tasks in this article:
- Create a client services Web project
- Deploy the project
- Test the deployed application
Before completing the steps in this article, you must have installed Rational Application Developer V6, WebSphere Everyplace Client Toolkit V6, and WebSphere Everyplace Deployment V6. Once the software is installed, launch Rational Application Developer.
- In Rational Application Developer, switch to the Web Development perspective by selecting Window => Open Perspective => Other => Web.
- Open the New Project wizard by selecting File => New => Project, as shown below:
Figure 1. Open New Project wizard
- In the New project dialog, you'll see several types of wizards you can use to create different kinds of client services projects. In this article, we'll focus on developing a Web project, so select Client Services Web Project, then click Next, as shown:
Figure 2. Select type of project wizard
- In the Client Services Web Project wizard, do the following:
- For Project name, specify
OrderBook
. - For Servlet Version, select 2.4. Everyplace Deployment also supports JSP 2.0, JSP 1.2, and Servlet 2.3 Web applications.
- Leave the remaining settings as the defaults, and click Next, as shown below:
Figure 3. Specify project information
- For Project name, specify
- On the Plaform Profile dialog, ensure that the default profile WebSphere Everyplace Deployment (6.0.0) Core is selected.
- Select neccessary services
- Click Finish to create the OrderBook Web project, as shown below:
Figure 4. Select platform profile
- Add a servlet and call it
OrderConfirm.java
. - The content of the doPost() method is:
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter out = resp.getWriter(); String[] books={"Web Development","Advanced Java","Enterprise Java", "Java: Complete Reference"}; int bookIndex=0,quantity=0; resp.setContentType("text/html"); try { bookIndex = Integer.parseInt(req.getParameter("bookname")); quantity = Integer.parseInt(req.getParameter("quantity")); } catch (Exception e) { out.write("<h1>Please mention the quantity!!"); } out.write("<h1><FONT color=\"blue\">You have ordered following..</FONT>"); out.write("<h2>Book Name: "+books[bookIndex]); out.write("<h2>Quantity: "+ quantity); out.close(); }
- Add a JSP file called
PlaceOrder.jsp
, which will take the inputs required by theOrderConfirm.java
servlet. - The OrderBook client services Web project is now ready for deploying on the WebSphere Everyplace Deployment runtime, which you can start from Rational Application Developer Version 6. Let's modify the plugin.xml file of OrderBook project so that it can be launched from the runtime. To do this, add the following content to plugin.xml:
<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin id="com.ibm.test.OrderConfirm" name="Order Books" version="1.0.0"> <extension point="com.ibm.eswe.workbench.WctWebApplication"> <DisplayName>Web Book Order</DisplayName> <Url>/OrderBook/PlaceOrder.jsp</Url> <BrowserOptions showAddressbar="true" showToolbar="false"/> <Icon></Icon> </extension> </plugin>
Client services Web applications run on the WebSphere Everyplace Deployment platform. The major difference between a Client services Web application and one that runs on a WebSphere Application Server or Apache Tomcat runtime is that a client services Web application must also be a valid OSGi bundle. The WebSphere Everyplace Client toolkit automatically handles many of these bundle-specific details; therefore, it is recommended that Web applications that are targeted for the WebSphere Everyplace Deployment platform or depend on other OSGi services besides core servlet and JSP support be developed through a client services Web project. However, you can also develop a Web application through a dynamic web project, and then test it on WebSphere Everyplace Deployment. WebSphere Everyplace Deployment does not support deploying enterprise applications through an Enterprise Archive (EAR). Web applications are directly deployed to the runtime.
- In the Project Explorer, right-click PlaceOrder.jsp, then select Run => Run on Server.
Figure 5. Run PlaceOrder.jsp
- In the Server Selection dialog, do the following:
- Select Manually define a server.
- Select WebSphere Everyplace Deployment v6.0.
- Click Finish to launch the WebSphere Everyplace Deployment runtime:
Figure 6. Define server
- Once WebSphere Everyplace Deployment starts, select the Open application icon, then select the Web Book Orderapplication.
- Place your order on the Place Your Order page. In this case, select Web Development in the Select the book field, enter
10
in the No. of copies field, and click Submit.
Figure 7. Select Web Book Order
- A results page displays, confirming that the server has received your request.
Figure 8. Order Result page
This article showed you how to get started using WebSphere Everyplace Client Toolkit and the WebSphere Everyplace Deployment runtime. You developed a client services Web application using Web development tools provided in the Rational Software Development Platform. In summary, the steps you completed to develop and deploy the Web project were:
- Created a client services Web project with the client services Web project wizard.
- Deployed the project, targeting the WebSphere Everyplace Deployment runtime when using the Run/Debug on the server action, or the WebSphere Everyplace Deployment launch configuration when using the Eclipse Run/Debug launch feature.
No comments:
Post a Comment