Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good combination of tools currently for implementing REST/J2EE/Database + custom auth

Was just wondering at the current point in time, what is a good combination of tools/frameworks/libraries for implementing a REST API on top of J2EE that integrates to a backend RDB and using OpenID for authentication.

What I am looking to implement is a server component that provides a set of services, all of which will utilise OpenID authentication, and the services will retrieve or update information to/from a backend relational database environment.

What I'm interested in are:

* application server options available (e.g. Tomcat, Glassfish etc.)
* IDE's (e.g. Eclipse, Netbeans, IntelliJ etc.)
* additional components useful for implementing REST (and JSON payloads)
* what is best practice/good technique/options available for database integration from the services (hibernate via spring, hibernate directly, raw jdbc connections ... )
* for integrating authentication via OpenID - what is an appropriate integration point for any custom authentication mechanism within the J2EE environment - are there any commonly used solutions/plug-ins available for OpenId etc.

Also any pointers to good, current tutorials, books etc.


Edit: Unfortunately I haven't had as much time to research the results to this question as I'd have liked.

At this stage I've found that installing/setting up REST with Jersey was very quick and I believe I can use a ContainerRequestFilter to provide the OpenID support as per the article here: http://plaincode.blogspot.com/2011/07/openid-authentication-example-in-jersey.html

I intend on using OpenId4Java for the OpenId support, with the PAPE extensions to get users email address returned. I don't need OAuth as I don't need to access any of the users other OpenID details or info on their OpenID site from my server app.

I've had a look at the latest Spring, it looks very good and if I were needing to build a web client with my solution, or had more time to look at both, I could easily have ended up leaning that way.

Thanks for the good answers and replies, hard to pick a single correct answer. I've accepted yves answer because it is correct and the way I'm going at the moment with minimal time to research properly, but awarded the bounty to cfontes answer, as it is also correct, and he's replied with additional information and justification.

like image 982
gamozzii Avatar asked Nov 08 '11 06:11

gamozzii


2 Answers

Make it simple and modern (Spring is neither one nor the other for RESTful web-services):

  • Jersey – the JAX-RS reference – defines resources and supports OAuth; its code is compact, easy to use & to plug to libraries (backends, etc...).

Take a look at this project on GitHub, it produces JSON from static data. Its web.xml and ProductResource are good places to start.

  • Every server will do the job, Jetty is my favorite, Tomcat, the standard
  • The choice of an IDE is up to you, the 3 you're giving are great, well integrated with Maven and source control tools. I use Eclipse from habit
like image 104
yves amsellem Avatar answered Nov 09 '22 22:11

yves amsellem


I would go for

  • Spring 3: this can be useful to wire things up with Dependency injection and other things.
  • Spring MVC: Restful support and Request mapping, a request based framework that integrates very well with Spring
  • Apache Tiles: to make the HTML templates easier to make.
  • Spring Security: it's a JAAS implementation and for me it's better and easier than Standard JAAS.( doesn't need a full web server, tomcat will do fine)

This can help you decide which Persistence provider you want : Persistence Provider comparison I would go for Hibernate, because it have a lot of great features like Criteria API, hibernate Search and it's widely used.

Of course your app should be using JPA 2 for the sake of interchangeability instead of using a Persistence provider directly ( it's not easy to chance from one to another but with JPA2 it's possible, also should be giving you a lot of trouble but it's possible)

like image 29
Cristiano Fontes Avatar answered Nov 09 '22 23:11

Cristiano Fontes