The helloworld-html5 quickstart demonstrates the use of CDI 1.2 and JAX-RS 2.0 using the HTML5 architecture and RESTful services on the backend.
The helloworld-html5 quickstart demonstrates the use of CDI 1.2 and JAX-RS 2.0 in {productNameFull} {productVersion} or later using the HTML5 + REST architecture.
The application is basically a smart, HTML5, CSS3, and JavaScript front-end using RESTful services on the backend.
-
HelloWorld.java: Establishes the RESTful endpoints using JAX-RS. -
web.xml: Maps RESTful endpoints to/hello. -
index.html: Is a jQuery augmented plain old HTML5 web page.
The example can be deployed using Maven from the command line or from Eclipse using JBoss Tools.
An HTML5 compatible browser such as Chrome, Safari 5+, Firefox 5+, or IE 9+ is required.
With the prerequisites out of the way, you are ready to build and deploy.
The application will be running at the following URL http://localhost:8080/{artifactId}/.
You can also test the REST endpoint by sending an HTTP POST request to the URLs below. Replace YOUR_NAME with a name of your choosing.
You can test The XML content by sending an HTTP POST to the following URL: http://localhost:8080/{artifactId}/hello/xml/YOUR_NAME
Type the following cURL command in terminal to issue the POST command:
curl -i -X POST http://localhost:8080/${project.artifactId}/hello/xml/__YOUR_NAME__You will see the following response:
Connection: keep-alive
HTTP/1.1 200 OK
X-Powered-By: Undertow/1
Server: JBoss-EAP/7
Content-Type: application/xml
Content-Length: 44
Date: Tue, 13 Oct 2015 18:40:04 GMT
<xml><result>Hello YOUR_NAME!</result></xml>You can test the JSON content by sending an HTTP POST to the following URL: http://localhost:8080/{artifactId}/hello/json/YOUR_NAME
Type the following cURL command in terminal to issue the POST command:
curl -i -X POST http://localhost:8080/${project.artifactId}/hello/json/YOUR_NAMEYou will see the following response:
HTTP/1.1 200 OK
Connection: keep-alive
X-Powered-By: Undertow/1
Server: JBoss-EAP/7
Content-Type: application/json
Content-Length: 29
Date: Tue, 13 Oct 2015 06:32:20 GMT
{"result":"Hello YOUR_NAME!"}