Tuesday Jan 28, 2014

Handling JAX-RS and Bean Validation Errors with MVC

Since JAX-RS 2.0 you can use Bean Validation to validate inputs received from users and outputs created in your application. It’s a handy feature and in most cases it works great. But what if you’re using also MVC and you want to display custom error page if something goes wrong? Or what if you want to handle Bean Validation issues in a slightly different way than JAX-RS implementation you’re using does? This article will give you some answers to these questions.

More in my original post on blog.dejavu.sk 

Tuesday Jan 21, 2014

Updating Jersey 2 in GlassFish 4

Different life-cycles of Jersey 2 and GlassFish 4 arise a question how to make sure that ones GlassFish instance contains always the latest version of Jersey. This question is even more important in case you don’t want to download the nightly/promoted build every-time a new version of Jersey is released but you still want to use the latest and greatest Jersey.

More in my original post on blog.dejavu.sk 

Thursday Jan 16, 2014

Managed JAX-RS Client

Common use-case in web-application development is aggregating data from multiple resources, combining them together and returning them to the used as XML/JSON or as a web page. In Java world these (external) resources can be approached via standardized Clients from JAX-RS 2.0. Jersey 2 application can use so-called managed client mechanism that brings a convenient way to create JAX-RS clients and web targets for such resources.

More in my original post on blog.dejavu.sk 

Thursday Jan 09, 2014

Running Jersey 2 Applications on Heroku

In this article we’ll create a simple Jersey application deploy it in Jetty servlet container and everything will be hosted on Heroku.

Create an Application

To create a skeleton of Jersey 2 web-app that can be run on Heroku from the jersey-heroku-webapp archetype (available since Jersey 2.5), execute the following Maven command in the directory where you want the new project should be located:

mvn archetype:generate -DarchetypeArtifactId=jersey-heroku-webapp \
    -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
    -DgroupId=com.example -DartifactId=simple-heroku-webapp -Dpackage=com.example \
    -DarchetypeVersion=2.5.1

Adjust the groupIdpackage and/or artifactId of your new web application project to your needs or, alternatively, you can change it by updating the new project pom.xml once it gets generated.

More in my original post on blog.dejavu.sk 

Wednesday Jan 08, 2014

Binding JAX-RS Providers to Resource Methods

When you register providers (such as filters and interceptors) in your application they’re associated and applied to each resource method by default. In other words they’re bound globally. For most cases this approach is sufficient but sometimes, especially when you want to use your provider only with a few methods, it’s not enough. JAX-RS 2.0 brings a solution for this situation: Name and Dynamic Binding.

More in my original post on blog.dejavu.sk 

About

Mirror of blog.dejavu.sk

Search

Categories
Archives
« January 2014 »
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
10
11
12
13
14
15
17
18
19
20
22
23
24
25
26
27
29
30
31
 
       
Today