Git Product home page Git Product logo

jersey-starterkit's Introduction

Overview

This is a starter project using jax-rs / jersey. I've created this because I often find myself wanting to expirement with something that needs a webservice, and this gives me a starting spot. Clone or fork and use as needed.

Note: if you like this version, I highly recommend checking out the sample dropwizard implemenation [https://github.com/jasonray/jersey-starterkit/tree/dropwizard], much better for quick implemenations of java based web services. I love me some dropwizard. Until I discovered node/express.

How-to run

  1. Compile The project compiles using gradle. If you already have gradle installed, compile using:
gradle build

If you do not have gradle installed, you can utilize the gradle wrapper included in the source

./gradlew war

The war file is compiled to: build/libs/jersey-starterkit.war

  1. Deploy the war file to web container. I've been using apache-tomcat [http://tomcat.apache.org], and typically copy the war to the tomcat webapps directory. On my machine:
cp build/libs/jersey-starterkit.war /Applications/apache-tomcat-6.0.33/webapps/

Shortcut: if you are using tomcat, and $CATALINA_HOME is set, you can run: ./deploy.sh

  1. Confirm that it is running by fetching the URL at on webcontainer + /jersey-helloworld/rest/hello. On my machine:
curl localhost:8080/jersey-starterkit/rest/hello

The supported endpoints are:

http://localhost:8080/jersey-starterkit/rest/customer/id/1
http://localhost:8080/jersey-starterkit/rest/echo?m=hello
http://localhost:8080/jersey-starterkit/rest/hello

Opening in Eclipse

If you use Eclipse, the gradle scripts are nice enough to create your eclipse project and classpath files.

First time only

If you have gradle installed, run:

gradle eclipse

Now you can import the project into eclipse.

Updating classpath files

If you update dependencies, pull the new libs into your classpath:

gradle eclipseClasspath

Logging

There is a log4j configuration defined in src/main/resources/log4j.properties. By default this will log to the STDOUT and to a series of log files. Change the logging configuration as needed.

If you would like to use the default logging, create the logging folders:

> sudo mkdir /restapi
> chmod a+wr /restapi

jersey-starterkit's People

Contributors

jasonray avatar

Watchers

James Cloos 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.