https://github.com/vmj/jaxrs-se-example
Example Java SE + JAX-RS applications
https://github.com/vmj/jaxrs-se-example
java-se jax-rs
Last synced: 8 months ago
JSON representation
Example Java SE + JAX-RS applications
- Host: GitHub
- URL: https://github.com/vmj/jaxrs-se-example
- Owner: vmj
- Created: 2016-09-15T21:06:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-04T20:36:20.000Z (over 8 years ago)
- Last Synced: 2025-02-03T22:40:52.699Z (about 1 year ago)
- Topics: java-se, jax-rs
- Language: Groovy
- Homepage:
- Size: 105 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
image:https://travis-ci.org/vmj/jaxrs-se-example.svg?branch=master["Build Status", link="https://travis-ci.org/vmj/jaxrs-se-example"]
# Example Java SE + JAX-RS applications
This repository contains one application based on RestEasy, and another based on Jersey.
Those are JAX-RS (think RESTful services) implementations readily usable in a Java SE environment.
For example, small apps or 12 factor apps.
## Why and What?
Think what you will about the enterprise Java as a whole, some of their technologies are really neat.
Also, since they are more and more usable without any heavy frameworks or boilerplate or configuration,
they are a real contender in Java SE space.
JAX-RS allows you to build RESTful APIs in a type safe and easy way.
## How it works
This project contains a `jaxrs` resources archive, which is just a JAR really.
This JAR forms the actual application.
There’s an `IndexResource` that is exposed in the `/` path,
and it exposes two sub-resources in path `/articles` and `/inquiries`.
You can make `GET` requests to the `/articles` end point, and receive a JSON list of articles.
You can also `POST` inquiries the the `/inquiries` end point.
Then there are two Java applications: jersey-jdk and resteasy-jdk.
Both are really small.
All they do is, they use container specific way of constructing the JAX-RS container
and then start the JDK `HttpServer`.
That’s it. (See the source code for more comments.)
## How to try it out
I'm using *gradle* build system, but you do not need to install that in order to build this.
All you need is *Java SE JDK*, version 8.
Clone this repository:
git clone https://github.com/vmj/jaxrs-se-example.git
cd jaxrs-se-example
And build the app:
./gradlew installDist
Then run the Jersey based app:
./jersey-jdk/build/install/jersey-jdk/bin/jersey-jdk
And the RestEasy based app:
./resteasy-jdk/build/install/resteasy-jdk/bin/resteasy-jdk
If you're on Windows, add `.bat` suffix to each script (`gradlew.bat`, `jersey-jdk.bat`, `resteasy-jdk.bat`).
You can clean up, too
./gradlew clean
Have fun!