Home » Enterprise Java » rest » Page 2

rest

JSON Example With Jersey and Jackson

In this post, we feature a comprehensive Example on JSON With Jersey and Jackson. We are going to see how you can integrate Jesrsey with Jackson to develop  JAX-RS RESTful services that produce and consume JSON streams. As you probably know, Jackson is used to marshal a Java Object to JSON, and ummarshal a JSON file (or stream in general) to ...

Read More »

XML Example With RESTEasy+ JAXB

In this example we are going to see how you can integrate RESTEasy with JAXB (Java Architecture for XML Binding) to create RESTful services that consume and produce XML streams. As you probably know JAXB is used to marshal a Java Object to XML, and ummarshal an XML file (or stream in general) to Java Object. In this example we are not going ...

Read More »

XML Example With Jersey + JAXB

In this example we are going to see how you can integrate Jersey with JAXB (Java Architecture for XML Binding) to create RESTful services that consume and produce XML streams. As you probably know JAXB is used to marshal a Java Object to XML, and ummarshal an XML file (or stream in general) to Java Object. You don’t have to ...

Read More »

RESTEasy File Upload Example

In this tutorial we are going to see how In this example we are going to see how you can upload a File to a server using a JAX-RS REST Service using RESTEasy. In this example we are going to use an HTML Form that has one input field of type file. When the HTTP POST request is constructed, it ...

Read More »

Jersey File Upload Example

In this example we are going to see how you can upload a File to a server using a JAX-RS REST Service using Jersey. Uploading a File using Jersey is fairly easy, as it uses all the HTTP infrastructure for file upload operations. In this example we are going to use an HTML Form that has one input field of ...

Read More »

JAX-RS Download File

In this example we are going to see how you can download a file from a JAX-RS REST Service. It’s significantly easy to do that, as it requires to annotate the bind method with the @Produces annotation. The @Produces annotation can used to used to specify the MIME media types a service can produce and send to the client. In ...

Read More »

Get HTTP Header In JAX-RS

In this example we are going to see how to get Request HTTP Header parameters in a JAX-RS REST Service. You can see the list of all Header fields in the HTTP 1.1 RFC. To be able to parse HTTP Header fields you can either use @HeaderParam to parse each Header field individually, or use @Context to inject an HttpHeaders object ...

Read More »

JAX-RS @FormParam Example

In this example we are going to see how to parse parameters submited by a form in a JAX-RS REST Service using @FormParam annotation. In this example we are not going to focus on how to create JAX-RS application from top to bottom. So make sure you read carefully Jersey Hello World Example and RESTEasy Hello World Example, and pay attention to the ...

Read More »

JAX-RS @QueryParam Example

In this example we are going to talk about how you can use @QueryParam annotation to parse URI Query Parameters in a JAX-RS RESTful service. Basically, @QueryParam denotes that the value of the Query Parameter with the corresponding name will be parsed, and if parsed correctly it will be available on the method argument denoted with@QueryParam. There are baically two ways to pass parameters in ...

Read More »

JAX-RS @PathParam Example

In this example we are going to talk about how you can use @PathParam annotation to parse Path Parameters in a JAX-RS RESTful service. Basically, @PathParam denotes that the value of the Path Parameter with the corresponding name, declared previously in the @Path annotation above the targeted method, will be parsed and if parsed correctly it will be available on the ...

Read More »