Restful Web Services Archive

Download pdf file from JAX-RS

In this tutorial we will discuss about download pdf files from JAX-RS, for user to download a file, annotate the method with @Produces(“application/pdf”) : Put @Produces(“application/pdf”) on service method, with a Response return type. It …

Download image file from JAX-RS

In this tutorial we will discuss about download image files from JAX-RS, for user to download a file, annotate the method with @Produces(“image/image-type”) :   Put @Produces(“image/png”) on service method, with a Response return type. …

Download text file from JAX-RS

In this tutorial we will discuss about download text files from JAX-RS,  for user to download a file, annotate the method with @Produces(“text/plain”) : Put @Produces(“text/plain”) on service method, with a Response return type. It …

Get HTTP header in JAX-RS

In this tutorial, we will discuss about the two ways to get HTTP request header in JAX-RS : Inject directly with @HeaderParam Pragmatically via @Context 1. @HeaderParam Example In this example, it gets the browser …

JAX-RS @FormParam example

In this tutorial we will discuss about @FormParam, In JAX-RS, you can use @FormParam annotation to bind HTML form parameters value to a Java method. The following example show you how to do it : …

JAX-RS @MatrixParam example

In this tutorial we will discuss about Matrix parameters, these are a set of “name=value” in URI path, for example- /salary/21111;empname=dinesh In above URI, the matrix parameter is “empname=dinesh”, separate by a semi colon “;”. …

JAX-RS @QueryParam example

In this article we will explain about the JAX-RS, you can use @QueryParam annotation to inject URI query parameter into Java method. for example, /employees/query?url=dineshonjava.com In above URI pattern, query parameter is “url=dineshonjava.com”, and you …