Skip to main content

Creating a Process Server based on OpenSource Technologies using REST

Posted by edgars on August 4, 2008 at 6:01 PM PDT

This is a post where I will try share some thoughts about where
REST could be useful inside a SOA architecture using Business Process
Management, in that case we will be using jBPM and RESTEasy, which is
the JBoss's implementation for JSR311
- Java Restful WebServices
.


RESTEasy


RestEasy is a project that is getting a good relevance in terms of
integration with some projects inside JBoss.ORG and even other
projects. If you are trying use a simple REST implementation you
should take a look on this projects, basically there are few steps
you must to do to put RestEasy working for your Application, so see
the following Steps:



  1. Download the RESTEasy
    from JBoss.ORG


  2. There is a worth documentation in RESTEasy
    Wiki
    , which I strongly recommend you read it first, in addition
    to this, in order to see some foundation for practical REST
    application, you can read this great
    blog entry
    written by Carol
    McDonald


  3. To make the things works, I recomend you read this link:
    http://wiki.jboss.org/wiki/RESTeasyInstall
    , RESTEasy is pretty easy to understand and apply in even legacy
    Java applications, where you can expose some methods simply putting
    some annotations into your pojos. Basically the steps are:




  • RESTeasy is deployed as a WAR archive and thus depends on a
    Servlet container. When you download RESTeasy and unzip it you will
    see that it contains an exploded WAR. Make a deep copy of the WAR
    archive for your particular application. Place your JAX-RS annotated
    class resources and providers within one or more jars within
    /WEB-INF/lib or your raw class files within /WEB-INF/classes.
    RESTeasy is configured by default to scan jars and classes within
    these directories for JAX-RS annotated classes and deploy and
    register them within the system:



Custom configuration


RESTeasy is implemented as a
ServletContextListener?
and a Servlet and deployed within a WAR file. If you open up the
WEB-INF/web.xml in your RESTeasy download you will see this:

<web-app>
   <display-name>Archetype Created Web Application</display-name>
   <context-param>
      <param-name>resteasy.scan</param-name>
      <param-value>true</param-value>
   </context-param>

   <listener>
      <listener-class>org.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
   </listener>

   <servlet>
      <servlet-name>Resteasy</servlet-name>
      <servlet-class>org.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
   </servlet>

   <servlet-mapping>
      <servlet-name>Resteasy</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

</web-app>


The ResteasyBootstrap listener is responsible for
initializing some basic components of RESTeasy as well as scanning
for annotation classes you have in your WAR file. It receives
configuration options from <context-param> elements. Here's a
list of what options are available



  • And that's all! Everything you need is ready to run your REST
    Services in any JEE App Server.



Proof of Concept of a

Related Topics >>