Skip to content
Starting Point for a JAX-RS based Web Service Implementation (using Gradle)
JavaScript CSS Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper
src/main
.gitignore
build.gradle
gradlew
gradlew.bat
readme.md
settings.gradle

readme.md

"JAX-RS: Java API for RESTful Web Services is a Java programming language API spec that provides support in creating web services according to the Representational State Transfer architectural pattern"

This project provides the Starter Code for an JAX-RS web-app, using gradle for building the app (i.e. war file) To add a service, take the com.techcasita.jersey.Echo class as an example. Add a class like that and register it in com.techcasita.jersey.MyApp .. .. build/depply/run and look at the active swagger documentation at http://localhost:8080/jersey/api-docs, which automatiacllly picked up teh service you added.

Compile / Build / Packaging using gradle

./gradle build
./gradlew war

The war file is compiled to build/libs/jersey.war

Deploying

Deploy the war by copying it into a web container such as Tomcat
cp build/libs/jersey.war $TOMCAT_HOME/webapps/
$TOMCAT_HOME/bin/startup.sh

Usage

When deployed into a local Tomcat instance, the index page is
http://localhost:8080

An example:
http://localhost:8080/jersey/service/echo?m=Hello

Documentation

Swagger Json:
http://localhost:8080/jersey/api-docs

Since there isn't a web.xml file, look for the context name inside the MyApp.java class. The name of the webapp is declared in the build.grade file E.g. Once the jersey.war get deployed onto a app server, you'd access like this:

You can’t perform that action at this time.