Java

It time to learn how to create a Web Service to authenticate user with their user name and password and how to issue a unique secure access token which our Mobile Application can use to send HTTP requests and communicate with protected web services of our API. For a free video tutorial on how to…

Read More RESTful Web Service to Authenticate User and Issue Access Token

In this blog post I am going to share with you a way to create a RESTful Web Service to: Create a new user profile, Generate and save in database a user secure user password rather than an actual password provided by user, Return back as a response a custom user profile object(JSON) with information that…

Read More RESTful Web Service to Save a New User in Database

When building RESTful Web Services for your Mobile app with Java JAX-RS and Jersey you can use any Java Servlet container to deploy and run your final .WAR file. But if you use Jetty then there is a very quick way to build and run your application using Maven and jetty-maven-plugin. Below is a short…

Read More Add Jetty Maven Plugin to Your JAX-RS Project

Hibernate is a great framework to use to persist data into a database when building RESTful Web Services for your mobile application with Jersey and JAX-RS. In most of the projects I have participated when designing RESTful Web Services for Mobile App we used MySQL database server and Hibernate framework to store user data which…

Read More Persist Java Object in MySQL Database With Hibernate

If one of you RESTful Web Service Endpoints built with Jersey JAX-RS needs to initiate image download, you can use the following example to let user download an image stored on your server  when they access a certain web service end point. The below example downloads a PNG image specified by @Produces(“image/png”) but you can easily…

Read More Image Download in Jersey JAX-RS

To make our Jersey RESTful Web Service Application be able to @Autowire service classes and inject Java Beans we will need to add to it a support for Spring Dependency Injection(DI) and below I am going to share with you how to do it. To add Spring DI support to my JAX-RS application, I am…

Read More Add Spring Dependency Injection Support to a JAX-RS Jersey App

We can use @HeaderParam annotation to read the Request HTTP Headers when building RESTFul Web Services. And knowing how to use @PathParam and @QueryParam annotations, the use of @HeaderParam annotation becomes very obvious. We just use it the same way as we use the @QueryParam for example. JAX-RS @HeaderParam Annotation Code Example. JAX-RS gives us a couple of ways to…

Read More JAX-RS @HeaderParam. Reading Request Headers.

@QueryParam annotation allows us to read the request parameter values which were passed as a part of URL query string for example: site.com/api/users/r4ghtaf43c3n/messages?start=1&limit=50 where site.com is your web site domain name, /api/users/ is the path to your Root Resource, r4ghtaf43c3n is the value of specific user id and can be read with @ParthParam annotation, /messages is…

Read More JAX-RS @QueryParam. Reading URL Query Parameters.