jersey
RESTful Web Services in Java.
Maven archetype
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp \ -DarchetypeGroupId=org.glassfish.jersey.archetypes \ -DinteractiveMode=false \ -DgroupId=com.example \ -DartifactId=simple-service-webapp \ -Dpackage=com.example \ -DarchetypeVersion=2.9
Maven dependency
Jersey 1.XX web.xml sample
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet> <description>JAX-RS Tools Generated - Do not modify</description> <servlet-name>JAX-RS Servlet</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>JAX-RS Servlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
Jersey 1.XX Rest Service Sample
package org.allowed.bitarus; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("svctest") public class TestService { @GET @Produces(MediaType.APPLICATION_JSON) public String testGet() { return "ResidentService Hello world !!!"; } }