Skip to main content

A REST project with Glassfish

Posted by felipegaucho on September 7, 2009 at 3:55 AM PDT

I am working out a new pet project, an online system to support PUJ Competitions. It is still a work under progress and I plan to start to blog some technical results here, but until that glorious free time I would give you a glimpse about what is keeping my blog so quiet :)

So, PUJ is an academic competition where undergraduate student submit their homeworks for the evaluation of Senior Professionals. It is a nice competition planned to happen in some JUGs in Brazil - and I hope to see it adopted in several other JUGs around the world.

I am producing basically a RESTfull web-service, based on Jersey and EJB 3.0. It is part of the self-education on Glassfish technologies I've started few years ago. I have so far:

  • Server: a EJB 3.0 backend + JPA/TopLink
  • Middleware: a Jersey RESTfull interface + JMS features like sending notification by email, twitter, etc
  • Frontend: an HTTP client - a DWR GUI...

The code and the application design is all under progress nowadays, noisy and smoking a bit ... but there are already some goodies for the eagers by novelties, so you can taste a bit of my REST-API on these HTTP Resources:

Observations about the above API:

  • JSON - to receive the responses in the json format, the client should include the HTTP Header Accept=application/json
  • It will support HATEOAS asap, I am still dealing with the design requirements  for implementing it on Java with Jersey. If you have an idea on how to implement it elegantly, please share this information with us. Basically I plan to include a link on every element returned from the server, so spiders or htt client can extract the next step from the resource itself instead of having a previous knowledge about where to find what.
  • Most of the data comes directly from the database, serialized by JAXB and filtered onthe Jersey layer.
  • Pagination works fine - managed by the the persistence layer, and using Jersey @DefaultValues in case no parameter is suplied by the client.
  • File upload is coming soon.
  • Security is also enabled using web.xml configurations. It is just disabled for testing purposes.

It is a lot of fun, I am learning a lot and missing a lot some people to produce GUIs to consume my service. We have a brave frontend developer (Sombriks) and some other students flerting with the chance to collaborate. You have your opportunity, just get your preferred HTTP enabled technology and start to consume my RESTful service.. and be my guest to ask anything about it.

Interested? So here are the links to know more about it:

That's it, I hope to find time to publish more detailed information about the project in the next few weeks, but for now this is the best I can offer ...