akadir / jersey-example

An example project to develop restful web-service using Jersey. Documentation: https://akadir.github.io/jersey-example/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jersey Example

Build Status Maintainability codecov Codacy Badge Quality Gate Status Technical Debt License: MIT

Example rest project to use jersey with filters and exception handlers.

mvn --version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T22:00:29+03:00)

jacoco prepare agent:

mvn clean jacoco:prepare-agent install

generate readable code coverage reports:

mvn jacoco:report

Docs

You can check this site to see implemented endpoint details: https://akadir.github.io/jersey-example

open-api.yaml file is here: open-api.yaml

To generate html file from open api yaml:

First install redoc-cli

npm install -g redoc-cli

then run this command:

redoc-cli bundle -o index.html openapi.yaml

this command will generate new index.html file.

Example cURL Requests

To make successful request SergenYalcin can be used as username with any password combination as you can see in Authenticator class.

  • GET /isUp:

    curl -X GET "http://localhost:8080/jersey-example/api/isUp" -H "accept: application/json" -H "Authorization: Basic U2VyZ2VuWWFsY2luOkJqazE5MDM="
  • GET /foo:

    curl -X GET "http://localhost:8080/jersey-example/api/foo?bar=bar" -H "accept: application/json" -H "Authorization: Basic U2VyZ2VuWWFsY2luOkJqazE5MDM="
  • POST /ipsum:

    curl -X POST "http://localhost:8080/jersey-example/api/ipsum" -H "accept: application/json" -H "Authorization: Basic U2VyZ2VuWWFsY2luOkJqazE5MDM=" -H "Content-Type: application/x-www-form-urlencoded" -d "foo=lorem"

License

The MIT License (MIT)

Copyright (c) kadir

About

An example project to develop restful web-service using Jersey. Documentation: https://akadir.github.io/jersey-example/

License:MIT License


Languages

Language:Java 99.0%Language:HTML 1.0%