org.codehaus.enunciate.modules.jersey
Class EnunciateJAXBContextResolver

java.lang.Object
  extended by org.codehaus.enunciate.modules.jersey.EnunciateJAXBContextResolver
All Implemented Interfaces:
javax.ws.rs.ext.ContextResolver<javax.xml.bind.JAXBContext>

@Provider
public class EnunciateJAXBContextResolver
extends java.lang.Object
implements javax.ws.rs.ext.ContextResolver<javax.xml.bind.JAXBContext>

Context resolver for JAXB.

Author:
Ryan Heaton

Constructor Summary
EnunciateJAXBContextResolver()
           
 
Method Summary
 javax.xml.bind.JAXBContext getContext(java.lang.Class<?> objectType)
           
static java.lang.ClassLoader getDefaultClassLoader()
          Return the default ClassLoader to use: typically the thread context ClassLoader, if available; the ClassLoader that loaded the EnunciateJAXBContextResolver class will be used as fallback.
protected  java.lang.Class loadClass(java.lang.String classname)
          Loads a class from the classpath.
protected  java.lang.Object loadPrefixMapper()
           
protected  java.io.InputStream loadResource(java.lang.String resource)
          Loads a resource from the classpath.
 java.util.Set<java.lang.Class> loadTypes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnunciateJAXBContextResolver

public EnunciateJAXBContextResolver()
                             throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

loadTypes

public java.util.Set<java.lang.Class> loadTypes()

loadPrefixMapper

protected java.lang.Object loadPrefixMapper()

getDefaultClassLoader

public static java.lang.ClassLoader getDefaultClassLoader()
Return the default ClassLoader to use: typically the thread context ClassLoader, if available; the ClassLoader that loaded the EnunciateJAXBContextResolver class will be used as fallback.

Call this method if you intend to use the thread context ClassLoader in a scenario where you absolutely need a non-null ClassLoader reference: for example, for class path resource loading (but not necessarily for Class.forName, which accepts a null ClassLoader reference as well).

Returns:
the default ClassLoader (never null)
See Also:
Thread.getContextClassLoader()

loadResource

protected java.io.InputStream loadResource(java.lang.String resource)
Loads a resource from the classpath.

Parameters:
resource - The resource to load.
Returns:
The resource.

loadClass

protected java.lang.Class loadClass(java.lang.String classname)
                             throws java.lang.ClassNotFoundException
Loads a class from the classpath.

Parameters:
classname - The class name.
Returns:
The class.
Throws:
java.lang.ClassNotFoundException

getContext

public javax.xml.bind.JAXBContext getContext(java.lang.Class<?> objectType)
Specified by:
getContext in interface javax.ws.rs.ext.ContextResolver<javax.xml.bind.JAXBContext>