Restlet’s JAXB extension in OSGi

When using JAXB in an OSGi container it is important to load the JAXB context into the correct class loader. This is actually an issue with any framework that has not been release for OSGi and uses class loaders. I ran into this when trying to use Restlet's JAXB extension.

The fix is actually pretty easy. When using the JaxbRepresentation it's important to pass the current class loader to the constructor. I extended JaxbRepresentation to make the client code lighter. You can find the code for this below:

Feel free to use the above as you see fit.