Giter Club home page Giter Club logo

jetty-jersey's Introduction

Jetty-Jersey

This project serves as a repository for examples on how to quickly setup a Jetty server with REST endpoints using Jersey as the JAX-RS provider.

Running the Example

Run the com.labs2160.example.JettyApp class.

mvn clean compile exec:java

You can then interact with the server using on the following URLs:

URL Description Expected Response
http://localhost:8080/jetty-jersey/echo/test (GET) Echoes the parameter message back to client test
http://localhost:8080/jetty-jersey/status (GET) Returns the current status of the application RUNNING
http://localhost:8080/jetty-jersey/counter (GET) Increments and returns the current counter value 1
http://localhost:8080/jetty-jersey/status (PUT) Update the status; try curl -X PUT -dnewStatus=MAINTENANCE_MODE ...

Packaging an Executable JAR

You can also package an "uber" JAR that can be executed anywhere you have Java installed. This automatically gets packaged as a secondary artifact whenever you do:

mvn clean package

To run it, execute the command:

java -jar target/jetty-jersey-1.0-SNAPSHOT-exec.jar 

Building and running a Docker image

In order to build the docker image, run the docker/prepare_docker_context.sh script first. Then build the docker image. For example:

cd docker
docker build -t my_image .

Then you can run the image and hit the services:

docker run -p 8080:8080 my_image
curl http://localhost:8080/jetty-jersey/status

jetty-jersey's People

Contributors

mdometita avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.