jax-rs hello world with resteasy - red hat€¦ · from...
TRANSCRIPT
![Page 1: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/1.jpg)
JAX-RS Hello Worldwith RESTEasy
![Page 2: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/2.jpg)
![Page 3: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/3.jpg)
![Page 4: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/4.jpg)
![Page 5: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/5.jpg)
![Page 6: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/6.jpg)
From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib
jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar
![Page 7: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/7.jpg)
Drag & Drop
![Page 8: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/8.jpg)
New Class
![Page 9: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/9.jpg)
![Page 10: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/10.jpg)
package mypackage;
import javax.ws.rs.Produces;import javax.ws.rs.GET;import javax.ws.rs.Path;
@Path("/helloworld")public class HelloWorldResource { @GET @Produces("text/plain") public String sayHello() {
return "Hello World"; }}
![Page 11: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/11.jpg)
![Page 12: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/12.jpg)
New Class
![Page 13: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/13.jpg)
![Page 14: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/14.jpg)
package mypackage;import java.util.Set;import java.util.HashSet;import javax.ws.rs.core.Application;public class MyRESTApplication extends Application {
private Set<Object> singletons = new HashSet<Object>();private Set<Class<?>> empty = new HashSet<Class<?>>();public MyRESTApplication(){
singletons.add(new HelloWorldResource());}@Overridepublic Set<Class<?>> getClasses() {
return empty;}@Overridepublic Set<Object> getSingletons() {
return singletons;}
}
![Page 15: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/15.jpg)
![Page 16: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/16.jpg)
Edit web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>My_JAX-RS_HelloWorld</display-name> <context-param> <param-name>javax.ws.rs.Application</param-name> <param-value>mypackage.MyRESTApplication</param-value> </context-param>
<listener><listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener><servlet>
<servlet-name>Resteasy</servlet-name><servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet><servlet-mapping>
<servlet-name>Resteasy</servlet-name><url-pattern>/*</url-pattern>
</servlet-mapping></web-app>
![Page 17: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/17.jpg)
![Page 18: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/18.jpg)
![Page 19: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/19.jpg)
![Page 20: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/20.jpg)
![Page 21: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/21.jpg)
![Page 22: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/22.jpg)
![Page 23: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/23.jpg)
21:58:58,169 INFO [TomcatDeployment] deploy, ctxPath=/My_JAX-RS_HelloWorld21:58:58,472 INFO [ResteasyDeployment] Deploying javax.ws.rs.core.Application: class mypackage.MyRESTApplication21:58:58,472 INFO [ResteasyDeployment] Adding singleton resource mypackage.HelloWorldResource from Application javax.ws.rs.core.Application
On Console tab, assumes server is already started
![Page 24: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/24.jpg)
Deployed
![Page 25: JAX-RS Hello World with RESTEasy - Red Hat€¦ · From jboss-soa-p.5.0.0\resteasy\resteasy-jaxrs.war\WEB-INF\lib jaxrs-api.jar, resteasy-jaxrs.jar, scannotation.jar](https://reader030.vdocuments.us/reader030/viewer/2022041011/5ebabba47899712a5b5c1b60/html5/thumbnails/25.jpg)