The source code of the Ajax: Hello! Sample application is provided within the AjaxHello.war Web module of the AjaxHello.ear file. There are two approaches to viewing the source code: through an Eclipse-based Integrated Development Environment (IDE) or by decompressing the AjaxHello.ear file, then decompressing the AjaxHello.war file contained inside.
The first step in viewing the source code is locating the AjaxHello.ear file. Depending on how you obtained and are viewing the documentation, there are two places the file can be located.
Linux® and UNIX®: <ECLIPSE_HOME>/plugins/com.ibm.websphere.samples.ajaxhello_1.1.0/AjaxHello.ear
|
Windows®:
<ECLIPSE_HOME>\plugins\com.ibm.websphere.samples.ajaxhello_1.1.0\AjaxHello.ear
|
Linux and UNIX: /opt/WebSphere/AppServer |
Windows: c:\WebSphere\AppServer
|
Linux and UNIX: /opt/WebSphere/AppServer/web2fep/samples/AjaxHello/AjaxHello.ear
|
Windows: c:\WebSphere\AppServer\web2fep\samples\AjaxHello\AjaxHello.ear
|
An Eclipse-based IDE is the simplest approach to examining the source code of the ear file. Use any Eclipse 3.2.X, 3.3.X with the Web Tools Project 2.5 or higher, or Rational Application Developer, version 7.0 or higher, can import the enterprise application archive (EAR) file when you complete the following steps: outlined below.
When the import process completes, two new projects exist in the Eclipse Project Explorer: AjaxHello and AjaxHello_WEB. The application source code can be accessed from the AjaxHello_WEB project. To access the client or server code, refer to the following table for source code locations in the AjaxHello_WEB Eclipse project tree.
Client side (Web Browser code)
|
WebContent/indexDevelopment.html: Contains the Dojo Widget definitions and script connection functions. This file loads the unoptimized dojo profile.
WebContent/indexOptimized.html: Contains the Dojo Widget definitions and script connection functions. This file loads the optimized dojo profile. WebContent/data/planets_filtered.json: Contains the data used to populate the dijit.form.Combobox widget. |
Server side (servlet code)
|
Java Resources: src/Web App Libraries/AjaxHelloServices.jar/com.ibm.websphere.samples.ajaxhello/Greeter.class: Double-clicking this class will load the source code.
Java Resources: src/Web App Libraries/AjaxHelloServices.jar/com.ibm.websphere.samples.ajaxhello/CompressionServlet.class: Double-clicking this class will load the source code. |
Enterprise application archives are file archives compressed using the ZIP algorithm. Therefore, the archive file can be expanded by any number of ZIP tools, including the Java archive (JAR) program. The following steps are written the user chooses to use their favorite ZIP tool.
After you have expanded the EAR file and WAR file contents, you can access the source code. To access the client or server code, refer to the following table for source code locations in the EXPAND_DIR/AjaxHello/AjaxHelloWAR directory.
Client side (Web Browser code)
|
indexDevelopment.html: Contains the Dojo Widget definitions and script connection functions. This file loads the unoptimized dojo profile.
indexOptimized.html: Contains the Dojo Widget definitions and script connection functions. This file loads the optimized dojo profile. data/planets_filtered.json: Contains the data used to populate the dijit.form.Combobox widget. |
Server side (servlet) code
|
AjaxHelloServices/com/ibm/websphere/samples/ajaxhello/Greeter.java
AjaxHelloServices/com/ibm/websphere/samples/ajaxhello/CompressionServlet.java |