Friday, September 23, 2011

JBossInBossa 2011 : Brazil

Next October 8th, we will be hosting the largest Brazilian JBoss User Group Conference in brazilian federal capital : Brasilia.

In 2010 we made a great conference in São Paulo, but this year we decide bring to Brasilia, once it is closer to Northeast and North region in Brazil, besides this city is one of the most important cities for opensource movement , there you can find a lot of government agencies in the public sector in Brazil, where they are consuming many opensource technologies.

We are proud to offer a high-level of speakers and sessions , covering many JBoss Technologies, in the speakers list the audience will be able to find some of JBoss Community stars, such as:

  • Flavia Rainone (Core Developer on AS7)
  • Mauricio Salatino (Committer in Drools/JBPM5)
  • Alexandre Porcelli (Contributions in Hibernate and Drools)
This year we made a Call 4 Papers with a very great level of speakers and sessions, so people will meet a lot of new speakers.

We also will have some Red Hat employees, from several departments, such as: Support, Consulting and Solutions Architects.

We used Google Translator in order to allow you check our agenda , and the best stuff about that event, the whole content we are charging just equivalent to US$25 , cheap hun?

Special thanks for James Cobb and Cheyenne Weaver for helping with our JBUG branding. 

Tuesday, January 18, 2011

Enabling RestEasy as JAX-RS Impl in Scalate

Scala as a language and its community is gaining a lot of attention, in fact, there are certain use cases where Scala offers incredible advantages over the traditional Java Language "as it is".

Although my experience with Scala so far is completely away from Web technologies, I've seen a lot of discussion about this matter, and a good solution for web applications can be basically a very simple composition:

  • HTML5 + REST Services [JSON]
  • HTML 5 + JavaScripts Toolkits such as JQuery and other + REST Service + [Many media types]

For the scenario that I mentioned above, I found out the framework Scalate, a good option for who is looking for a good getting started with Scala and Web.

 If you go in the Scalate's Getting Started Tutorial, everything works fine.  I spent the last couple of weeks researching a lot about which IDE to use, and at this moment honestly I recommend you use InteliJ Idea Community Edition with Scala plugins, it works incredibly fine and pleasant.

Well, but this post's title is about to enable RestEasy in Scalate Projects, so here will go deeper in this subject: Scalate by default comes with Jersey support implementation, which is another JAX-RS implementation, nevertheless for obvious reasons :) I prefer JBoss RestEasy, and in this post you will learn how you can change your scalate project to use RestEasy instead Jersey.

Everything I made is on my github online repository, I called this "version" of my scalate+resteasy project: easyscala, and you can checkout all the sources from here:

Changing the pom.xml

This is the first task you have to do, so you have to add RestEasy dependency in the pom.xml, although there is an important detail that I noticed when I tried to do that:
  • If you do not ignore the org.slf4j package, you will get an error, that I had not chance to go deeper to check the reason, that's why when I added RestEasy dependency I excluded the reference for this package, maybe some version conflicts of any other stupid thing that I had no time to check.




Changing the web.xml

Another change that I did, was in web.xml, where I removed the Jersey Servlet Filter's and any related configuration, and I added the RestEasy declaration as the following code:

     resteasy.scan     true

      resteasy.servlet.mapping.prefix      /resteasy



With a few changes, I was able to run the first REST Service made with JBoss RestEasy, look that we have a very standard JAX-RS Class in the following example:

package org.jboss.easyscala

import{GET, Path, Produces}

class RootService {

  @Produces(Array("text/xml", "application/json"))
  def getMediaType = "hello"

  def getHTML = "hello"

In the class above, we have 2 methods, according to the mime type (media type) that this service is requested, one of them will send the response. Another good point, at this moment, you cannot see any JBoss RestEasy proprietary extension. Obviously according your needs, you may add some helpers.


Scala and their related projects and solutions are gaining a lot of attention, it combines two programming models: OO and Functional, and this combination can make our codes easier, smaller and smarter. I cannot predict that much, but I am working in some specific Use Cases that were totally suitable for Scala, I am not talking about boilerplate code, but about less code with more power, and getting a huge difference when performance is a relevant issue. If you like JBoss tecnologies, like me, this is the first post where I will try show some good and relevant combinations.