Coder Social home page Coder Social logo

coursera4ashok / jersey_restful_webservice Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 32 KB

RESTful web service

Home Page: https://robertleggett.wordpress.com/2014/01/29/jersey-2-5-1-restful-webservice-jax-rs-with-jpa-2-1-and-derby-in-memory-database/

Java 100.00%

jersey_restful_webservice's Introduction

jersey_restful_webservice

Build Status

Jersey 2.5.1 RESTful Web Service with JPA 2.1 implemented using EclipseLink 2.5.2 and using Derby 10.10.1.1 In Memory Database

This is an example of an RESTful WebService using Jersey for the JAX-RS implementation, Genson for the JSON to Java / Java to JSON data binding, EclipseLink for the JPA implementation and Derby for the In Memory Database.

Jersey is Oracles implementation of the JAX-RS 2.0 API.

Genson simply binds the data from JSON to Java and vice versa, you do not have to configure POJO mapping in the web.xml or specify @XmlRootElement to POJO objects.

EclipseLink implements the Java JPA 2.0 API which is used for transaction management, persistence configuration and data binding between tables and POJOs via annotations.

Derby is used to store data also allowing you to run an embedded database, in memory database etc.

Jersey Test Framework 2.5.1 will execute unit tests and allow for the http response to be tested, this has been combined with Mockito to mock out the services however if you wish based out your configuration you can also perform end to end tests.


Test

Ensure the context root is set to jrws and post of web server is 8080 (for example purposes)

Once you have started up the application

http://localhost:8080/jrws

  • Will navigate you to the index.jsp to ensure the application is running.

Example Restful Calls

Ensure you set the content-type in your request to application/json

SAVE:

url = http://localhost:8080/jrws/rest/customer/save method = POST data = {"id":"1", "firstName":"Robert", "lastName":"Leggett"}

RETRIEVE:

url = http://localhost:8080/jrws/rest/customer/retrieve/1 method = GET

DELETE:

url = http://localhost:8080/jrws/rest/customer/delete method = POST data = 1

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.