Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

beta - used in production

Icon

org.tynamo:tapestry-resteasy:0.2.0
Works with RestEASY 2.0-beta-2

User guide for Tapestry-resteasy module

Tapestry-resteasy provides integration with JBoss' RESTEasy, an implementation JAX-RS (Java API for RESTful Web Services). JAX-RS is a very nice little spec and if you know what it is about, the following should be very easy to understand. Otherwise, read up on it at Jersey's overview (the reference implementation) or the actual specification. JBoss' RESTEasy provides a few more features over the reference implementation.

To use tapestry-resteasy (an independent module of Tynamo), you need to add the following dependency to your pom.xml:

No need to edit your web.xml.

The new tapestry-resteasy integrates with the Tapestry's HttpServletRequest pipeline.

Create a package named "rest" for your rest services.

tapestry-resteasy will scan the "rest" package and automatically add singleton resources to the configuration.

Code your singleton resource.

Good practices:

  • Name the resource class using the entity name followed by the word "Resource".
  • The @Path should be the entity name in lowercase.

Icon

By default tapestry-resteasy does not includes any marshaller/unmarshaller dependency.

You will need to manually add the dependency to your pom.xml
The next example uses a JSON (jettison) marshaller/unmarshaller.

For example:

Don't forget to annotate your entities with JAXB annotations. You need at least @XmlRootElement. http://www.caucho.com/resin/doc/jaxb-annotations.xtp

For example:

If you want, you can manually contribute singleton resources in your AppModule:

And enjoy.

Note:

If you get this exception:

Add this to your system properties:

like so:

mvn jetty:run

Check google for more information: http://www.google.com/search?hl=en&q=com.sun.xml.stream.ZephyrParserFactory+cannot+be+cast+to+org.codehaus.stax2.XMLInputFactory2&aq=f&oq=&aqi=

  • No labels