Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 166 lines (112 sloc) 6.994 kb
3d0fc04 Initial commit
Bruno Oliveira authored
1 poh5: Example AeroGear Application Using Multiple HTML5, Mobile & JAX-RS Technologies
2 ==============================================================================================
3 Author: Jay Balunas
4
5 What is it?
6 -----------
7
8 This is your project! It's a deployable Maven 3 project to help you
9 get your foot in the door developing HTML5 based desktop/mobile web applications with Java EE 6
10 on JBoss. This project is setup to allow you to create a basic Java EE 6 application
11 using HTML5, jQuery Mobile, JAX-RS, CDI 1.0, EJB 3.1, JPA 2.0 and Bean Validation 1.0. It includes
12 a persistence unit and some sample persistence and transaction code to help
13 you get your feet wet with database access in enterprise Java.
14
15 This application is built using a technique called Plain Old HTML5 (POH5). This uses a pure HTML
16 client that interacts with with the application server via restful end-points (JAX-RS). This
17 application also uses some of the latest HTML5 features and advanced JAX-RS. And since testing
18 is just as important with POH5 as it is server side, this application also uses QUnit to show
19 you how to unit test your JavaScript.
20
21 What is a modern web application without mobile web support? This application also integrates
22 jQuery mobile and basic client side device detection to give you both a desktop and mobile
23 version of the interface. Both support the same features, including form validation, member
24 registration, etc. However the mobile version adds in mobile layout, touch, and performance
25 improvements needed to get you started with mobile web development on JBoss.
26
27 System requirements
28 -------------------
29
30 All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven
31 3.0 or better.
32
33 The application this project produces is designed to be run on JBoss AS 7 or JBoss Enterprise Application Platform 6.
34
35 An HTML5 compatible browser such as Chrome, Safari 5+, Firefox 5+, or IE 9+ are
36 required. and note that some behaviors will vary slightly (ex. validations) based on browser support,
37 especially IE 9.
38
39 Mobile web support is limited to Android and iOS devices. It should run on HP,
40 and Black Berry devices as well. Windows Phone, and others will be supported as
41 jQuery Mobile announces support.
42
43 With the prerequisites out of the way, you're ready to build and deploy.
44
45 Deploying the application
46 -------------------------
47
48
49 First you need to start the JBoss container. To do this, run
50
51 $JBOSS_HOME/bin/standalone.sh
52
53 or if you are using windows
54
55 $JBOSS_HOME/bin/standalone.bat
56
57 Note: Adding "-b 0.0.0.0" to the above commands will allow external clients (phones, tablets,
58 desktops, etc...) connect through your local network.
59
60 For example
61
62 $JBOSS_HOME/bin/standalone.sh -b 0.0.0.0
63
64 To deploy the application, you first need to produce the archive to deploy using
65 the following Maven goal:
66
67 mvn package
68
69 You can now deploy the artifact by executing the following command:
70
71 mvn jboss-as:deploy
72
73 This will deploy `target/poh5`.
74
75 The client application will be running at the following URL <http://localhost:8080/poh5/>.
76
77 To undeploy run this command:
78
79 mvn jboss-as:undeploy
80
81 You can also start the JBoss container and deploy the project using JBoss Tools. See the
82 <a href="https://docs.jboss.org/author/display/AS71/Getting+Started+Developing+Applications+Guide" title="Getting Started Developing Applications Guide">Getting Started Developing Applications Guide</a> for more information.
83
84
85 You can also deploy the application directly to OpenShift, Red Hat's cloud based PaaS offering, follow the instructions [here](https://community.jboss.org/wiki/DeployingHTML5ApplicationsToOpenshift)
86
87 Minification
88 ============================
89
90 By default, the project uses the [wro4j](http://code.google.com/p/wro4j/) plugin,
91 which provides the ability to concatenate, validate and minify JavaScript and CSS
92 files. These minified files, as well as their unmodified versions are deployed with
93 the project.
94
95 With just a few quick changes to the project, you can link to the minified versions
96 of your JavaScript and CSS files.
97
98 First, in the <project-root>/src/main/webapp/index.html file, search for
99 references to minification and comment or uncomment the appropriate lines.
100
101 Finally, wro4j runs in the compile phase so any standard build command like package,
102 install, etc. will trigger it. The plugin is in a profile with an id of "minify" so
103 you will want to specify that profile in your maven build. For example:
104
105 mvn clean package jboss-as:deploy -Pminify
106
107 Running the Arquillian tests
108 ============================
109
110 By default, tests are configured to be skipped. The reason is that the sample
111 test is an Arquillian test, which requires the use of a container. You can
112 activate this test by selecting one of the container configuration provided
113 for JBoss.
114
115 To run the test in JBoss, first start the container instance. Then, run the
116 test goal with the following profile activated:
117
118 mvn clean test -Parq-jbossas-remote
119
120 Running the QUnit tests
121 ============================
122
123 QUnit is a JavaScript unit testing framework used and built by jQuery. This
124 application includes a set of QUnit tests in order to verify JavaScript that
125 is core to this HTML5 application. Executing QUnit test cases is quite easy. First,
126 make sure the server is running and the project has been deployed as some of the
127 tests will be testing the functionality of the services. Then, simply load the
128 following HTML in the browser you wish to test.
129
130 <project-root>/src/test/qunit/index.html
131
132 For more information on QUnit tests see http://docs.jquery.com/QUnit
133
134 Importing the project into an IDE
135 =================================
136
137 If you created the project using the Maven archetype wizard in your IDE
138 (Eclipse, NetBeans or IntelliJ IDEA), then there is nothing to do. You should
139 already have an IDE project.
140
141 Detailed instructions for using Eclipse / JBoss Tools with are provided in the
142 <a href="https://docs.jboss.org/author/display/AS71/Getting+Started+Developing+Applications+Guide" title="Getting Started Developing Applications Guide">Getting Started Developing Applications Guide</a>.
143
144 If you created the project from the command line using archetype:generate, then
145 you need to import the project into your IDE. If you are using NetBeans 6.8 or
146 IntelliJ IDEA 9, then all you have to do is open the project as an existing
147 project. Both of these IDEs recognize Maven projects natively.
148
149 Downloading the sources and Javadocs
150 ====================================
151
152 If you want to be able to debug into the source code or look at the Javadocs
153 of any library in the project, you can run either of the following two
154 commands to pull them into your local repository. The IDE should then detect
155 them.
156
157 mvn dependency:sources
158 mvn dependency:resolve -Dclassifier=javadoc
159
160 Development notes
161 =================
162
163 Copyright headers
164 -----------------
165
166 To update the copyright headers, just run `mvn license:format -Dyear=<current year>`
Something went wrong with that request. Please try again.