com.sun.jersey.api.container
Class ContainerFactory

java.lang.Object
  extended by com.sun.jersey.api.container.ContainerFactory

public final class ContainerFactory
extends java.lang.Object

Factory for creating specific HTTP-based containers.

Author:
Paul.Sandoz@Sun.Com

Method Summary
static
<A> A
createContainer(java.lang.Class<A> type)
          Create an instance of a container according to the class requested.
static
<A> A
createContainer(java.lang.Class<A> type, java.lang.Class<?>... resourceClasses)
          Create a container according to the class requested.
static
<A> A
createContainer(java.lang.Class<A> type, ResourceConfig resourceConfig)
          Create a container according to the class requested.
static
<A> A
createContainer(java.lang.Class<A> type, java.util.Set<java.lang.Class<?>> resourceClasses)
          Create a container according to the class requested.
static
<A> A
createContainer(java.lang.Class<A> type, java.lang.String... paths)
          Create an instance of a container according to the class requested.
static
<A> A
createContainer(java.lang.Class<A> type, java.lang.String packageName)
          Create an instance of a container according to the class requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createContainer

public static <A> A createContainer(java.lang.Class<A> type,
                                    java.lang.Class<?>... resourceClasses)
                         throws ContainerException,
                                java.lang.IllegalArgumentException
Create a container according to the class requested.

The list of service-provider supporting the ContainerProvider service-provider will be iterated over until one returns a non-null container instance.

Type Parameters:
A - the type of the container.
Parameters:
type - the type of the container.
resourceClasses - the list of Web resources to be managed by the Web application.
Returns:
the container.
Throws:
ContainerException - if there is an error creating the container.
java.lang.IllegalArgumentException - if no container provider supports the type.

createContainer

public static <A> A createContainer(java.lang.Class<A> type,
                                    java.util.Set<java.lang.Class<?>> resourceClasses)
                         throws ContainerException,
                                java.lang.IllegalArgumentException
Create a container according to the class requested.

The list of service-provider supporting the ContainerProvider service-provider will be iterated over until one returns a non-null container instance.

Type Parameters:
A - the type of the container.
Parameters:
type - the type of the container.
resourceClasses - the set of Web resources to be managed by the Web application.
Returns:
the container.
Throws:
ContainerException - if there is an error creating the container.
java.lang.IllegalArgumentException - if no container provider supports the type.

createContainer

public static <A> A createContainer(java.lang.Class<A> type,
                                    ResourceConfig resourceConfig)
                         throws ContainerException,
                                java.lang.IllegalArgumentException
Create a container according to the class requested.

The list of service-provider supporting the ContainerProvider service-provider will be iterated over until one returns a non-null container instance.

Type Parameters:
A - the type of the container.
Parameters:
type - the type of the container.
resourceConfig - the resource configuration containing the set of Web resources to be managed by the Web application.
Returns:
the container.
Throws:
ContainerException - if there is an error creating the container.
java.lang.IllegalArgumentException - if no container provider supports the type.

createContainer

public static <A> A createContainer(java.lang.Class<A> type,
                                    java.lang.String packageName)
                         throws ContainerException,
                                java.lang.IllegalArgumentException
Create an instance of a container according to the class requested.

Type Parameters:
A - the type of the container.
Parameters:
type - the type of the container.
packageName - the name of the package where to find the resource configuration class.
Returns:
the HTTP handler, if a handler could not be created then null is returned.
Throws:
ContainerException - if the resource configuration class could not be found and instantiated or there is an error creating the container.
java.lang.IllegalArgumentException - if no container provider supports the type.

createContainer

public static <A> A createContainer(java.lang.Class<A> type)
Create an instance of a container according to the class requested.

All java classpath will be scanned for Root Resource Classes.

Type Parameters:
A - the type of the container.
Parameters:
type - the type of the container.
Returns:
the HTTP handler, if a handler could not be created then null is returned.
Throws:
java.lang.IllegalArgumentException - if no container provider supports the type.

createContainer

public static <A> A createContainer(java.lang.Class<A> type,
                                    java.lang.String... paths)
Create an instance of a container according to the class requested.

Root Resource Classes will be scanned in paths.

Type Parameters:
A - the type of the container.
Parameters:
type - the type of the container.
paths - a list of paths to be scanned for resource classes.
Returns:
the HTTP handler, if a handler could not be created then null is returned.
Throws:
java.lang.IllegalArgumentException - if no container provider supports the type.


Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.