1. Jersey RESTful Client API Authentication Example

    In this tutorial, we will learn to build Jersey restful client using HttpAuthenticationFeature, which can be used to access REST APIs behind authentication/authorization security. For example purpose, I will creating jersey client for services which we secured in Jersey Secured REST APIs tutorial; and I will be extending the sourcecode created for Jersey RESTful client […]

  2. JAX-RS Jersey REST API Security Example

    In this example, we will learn to secure Jersey REST APIs behind basic authentication which will make mandatory to provide username/password by user. Also, user must have certain level of role as well. I have extended this example from my other example created for RESTEasy API security and used ContainerRequestFilter implementation to verify access of […]

  3. JAX-RS Jersey + Google Gson Example

    This tutorial explains how to use google Gson with Jersey 2.x. There are some other java libraries also capable of doing this conversion e.g. MOXy, Jackson or JSONP; but Gson stands among very few which do not require any pre-annotated java classes OR sourcecode of java classes in any way. Table of Contents Maven dependencies/changes […]

  4. JAX-RS Jersey + JSONP Example

    This tutorial explains how to use JSONP JSON provider with Jersey 2.x. JSONP is also auto-discoverable just like what we discussed in Jersey MOXy example. Table of Contents JSONP maven dependencies/changes REST API code Model bean changes Manually adding JsonProcessingFeature JSONP maven dependencies/changes JSONP media module is one of the modules in Jersey 2.x where […]

  5. JAX-RS Jersey + MOXy JSON Example

    This tutorial explains how to use MOXy JSON feature with Jersey 2.x. MOXy is the default JSON-Binding Provider in Jersey 2.x. Though I still personally prefer Jackson over MOXy for performance reasons. Table of Contents MOXy maven dependencies/changes REST API code Model bean changes Manually adding MoxyJsonFeature Customize behavior using MoxyJsonConfig Demo MOXy maven dependencies/changes […]

  6. Jersey-quickstart-archetype Hello World Application Example

    In this example, we will create a jersey RESTful API web application using jersey-quickstart-webapp maven archetype in eclipse. Table of Contents Install remote archetypes in eclipse Create new maven project using jersey-quickstart-webapp Generated Files Run The Application Install remote archetypes in eclipse The very first step before creating actual maven quick-start application, is to install […]

  7. Case-insensitive @Path URLs with JAX-RS Jersey

    By default in JAX-RS, ALL URLs specified in @Path annotations are CASE-SENSITIVE. In this tutorial, I am giving a simple example of CASE-INSENSITIVE URLs which cane be used inside @Path annotation on any Jersey JAX-RS REST API. How to make URLs case in-sensitive To make URLs case-insensitive, change the @Path URLs like below: Change above […]

  8. How to Import Maven Remote Archetype Catalogs in Eclipse

    This tutorial gives easy instructions for importing maven remote archetype catalogs in eclipse to give you head start in configuring the project. Using archetype automatically import all basic runtime dependencies and configure the project with most basic configuration which you can directly use to build hello world applications within minutes. Step 1 : Open maven […]

  9. JAX-RS Jersey RESTful Client Examples

    Jersey 2.x RESTful client API finds inspiration in the proprietary Jersey 1.x Client API but has many differences you may like to know before writing client side source code. JAX-RS Client API is a designed to allow fluent programming model. This means, a construction of a Client instance, from which a WebTarget is created, from […]

  10. JAX-RS (Jersey) Custom Exceptions Handling with ExceptionMapper

    In this example, we will learn to handle custom exceptions using ExceptionMapper interface while developing Jersey RESTful web services. For demo purpose, I am modifying the sourcecode written for jersey download file example. Table Of Contents Create Custom Exception with ExceptionMapper API changes Demo Create Custom Exception with ExceptionMapper To handle custom exception in JAX-RS […]

Java blog for smart concepts and coding practices