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.
Earlier I have shared with you how to use JAX-RS to access HTTP GET Request and how extract URI Query Parameters and how to read Path Parameters. In this blog post I am going to share with you how to handle HTTP POST request and how to read the content of HTTP Request Body as…Read More Jersey HTTP Post Example
@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.
In this blog post I am going to share with you how to read the PathParam value which was included in the request URI. And before you continue further I would like to mention that I have recorded a video lesson on how to use the @PathParam annotation and made it part of my video…Read More JAX-RS @PathParam. Reading Path Parameters.
In this blog post I am going to share with you how to handle HTTP GET request in your Java Web Service created with Jersey framework and how to response back with XML or JSON Response. If you do not have your Java RESTful Web Service created yet please follow the below link to a…Read More Jersey HTTP GET Example
In this blog post I will share with you how to use Maven to generate a very simple Jersey application which you can then use to build RESTful web services for your mobile app. I will also show you how to edit pom.xml file to add needed dependencies, so that your Jersey app is able…Read More Create Jersey JAX-RS Project with Maven
In this blog post, I am going to share with you how to generate a Java project with Maven. You will also learn how to package your project with all the dependent libraries into a single jar file and run your Java application via the command line in the terminal window. Step 1: Install Maven…Read More Create Java Project with Maven
When a user signs up for our mobile app, we require them to create a secure password, which we then store in our database. However, we know that storing passwords as plain text is not secure, as it allows anyone who views the database to access users’ actual passwords. To protect these passwords from being…Read More Encrypt User Password Example in Java
The below code examples demonstrates how to create a new array of 5 elements of String data type in Java and how to populate each array element. You will also learn how to access each array element individually and print out its value. Create a New Array in Java. Code example. package com.appsdeveloperblog.arrays; public class…Read More Create New Array Example in Java
In this little Java code example you will learn how to create a new file in Java. Please note that the path to the file is absolute. Also note the use of createNewFile() function which will also check for existence of the file before creating a new one. So there is no need to write…Read More Create New File In Java