A REST Project With Glassfish
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:
- Read supported roles for institutions
- Read all institutions with a PUJ Competition
- Read the institutions by role (/arena-http/institution?role={ROLE}?offset={int}&max={int})
- Read all participants of a competition (/{COMPETITION_NAME}/user)
- Read the participants by role (/{COMPETITION_NAME}/user?role={USER_ROLE})
- Read all homeworks of a competition (/{COMPETITION_NAME}/homework?offset={int}&max={int})
- Read a homework by name (/{COMPETITION_NAME}/homework/{HOMEWORK_NAME})
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:
- http://kenai.com/projects/puj/pages/PUJ-API
- http://kenai.com/projects/puj/pages/PUJ-SPEC (this also contains a list of REST references)
- http://kenai.com/projects/puj/pages/Home
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 ..
- Login or register to post comments
- 5213 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)




Comments
Odero Kennedy replied on Wed, 2009/09/09 - 4:34am
Hi Felipe. Am interested in creating a front-end for the PUJ System.
Whats the period of time like? Put another way, how much time do i have? :D
Thanx en keep up with the good work!
Felipe Gaúcho replied on Wed, 2009/09/09 - 7:50am
in response to: kodero83
kodero83,
your help is very and always welcome :)
We have 1 prototype: http://fgaucho.dyndns.org:8080/arena-dwr/
It is a student effort to create a GUI with DWR.
The good point of our project is: it is built by Maven, so we can create a new module to accomodate your preferred technololy. So, if you like Ruby or JSF, JavaFx or any other frontend technology, we just include a Maven module for you... and then you are free to take decisions about this module.. :)
The PUJ competitions will run at the end of the year in Brazil, but this is a continuous effort to provide an online system to PUJ - you can start anytime and it will be done when it is done :) The main goal of this project are:
- to have a real world example of Jersey service. With real people consuming the service.
- to learn a lot and to have fun while doing that.
if you like the idea, please register yourself in the Kenai project and checkout all src code .. and the, please start ;)
Odero Kennedy replied on Thu, 2009/09/10 - 2:47am
in response to: fgaucho
Thanks Felipe.
Is the Kenai Project only open to student? I tried signing up but i couldn't since am not a student (atleast not now ;-) ). What do u advice?
Felipe Gaúcho replied on Thu, 2009/09/10 - 6:16am
Kenai and the PUJ project are open for everyone... you should be able to register yourself at Kenai and do request an Observer role in the project.
You should start here: https://kenai.com/people/signup
* if you already have a kenai login and you are having problems to join the project, you can send me a private email to fgaucho @ gmail and I will check what is the problem...
john green green replied on Tue, 2009/11/03 - 2:20am