org.glassfish.admin.rest
Class LazyJerseyInit

java.lang.Object
  extended by org.glassfish.admin.rest.LazyJerseyInit
All Implemented Interfaces:
LazyJerseyInterface

public class LazyJerseyInit
extends java.lang.Object
implements LazyJerseyInterface

Class that initialize the Jersey container. It is called via introspection from RestAdapter so that RestAdapter does not depend on Jersey classes. This way, we gain 90ms at startup time and load the jersey classes only at the very last time, when needed. It is safe to have imports on com.sun.jersey.* APIs in this class.

Author:
ludo

Constructor Summary
LazyJerseyInit()
           
 
Method Summary
 com.sun.grizzly.tcp.http11.GrizzlyAdapter exposeContext(java.util.Set classes, ServerContext sc, org.jvnet.hk2.component.Habitat habitat)
          Called via introspection in the RestAdapter service() method only when the GrizzlyAdapter is not initialized
 java.util.Set<java.lang.Class<?>> getResourcesConfigForManagement(org.jvnet.hk2.component.Habitat habitat)
           
 java.util.Set<java.lang.Class<?>> getResourcesConfigForMonitoring(org.jvnet.hk2.component.Habitat habitat)
           
 RestConfig getRestConfig(org.jvnet.hk2.component.Habitat habitat)
           
 void reportError(com.sun.grizzly.tcp.http11.GrizzlyRequest req, com.sun.grizzly.tcp.http11.GrizzlyResponse res, int statusCode, java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyJerseyInit

public LazyJerseyInit()
Method Detail

exposeContext

public com.sun.grizzly.tcp.http11.GrizzlyAdapter exposeContext(java.util.Set classes,
                                                               ServerContext sc,
                                                               org.jvnet.hk2.component.Habitat habitat)
                                                        throws EndpointRegistrationException
Called via introspection in the RestAdapter service() method only when the GrizzlyAdapter is not initialized

Specified by:
exposeContext in interface LazyJerseyInterface
Parameters:
classes - set of Jersey Resources classes
sc - the current ServerContext, needed to find the correct classpath
Returns:
the correct GrizzlyAdapter
Throws:
EndpointRegistrationException

getRestConfig

public RestConfig getRestConfig(org.jvnet.hk2.component.Habitat habitat)
Specified by:
getRestConfig in interface LazyJerseyInterface

reportError

public void reportError(com.sun.grizzly.tcp.http11.GrizzlyRequest req,
                        com.sun.grizzly.tcp.http11.GrizzlyResponse res,
                        int statusCode,
                        java.lang.String msg)
Specified by:
reportError in interface LazyJerseyInterface

getResourcesConfigForMonitoring

public java.util.Set<java.lang.Class<?>> getResourcesConfigForMonitoring(org.jvnet.hk2.component.Habitat habitat)
Specified by:
getResourcesConfigForMonitoring in interface LazyJerseyInterface

getResourcesConfigForManagement

public java.util.Set<java.lang.Class<?>> getResourcesConfigForManagement(org.jvnet.hk2.component.Habitat habitat)
Specified by:
getResourcesConfigForManagement in interface LazyJerseyInterface


Copyright © 2012 GlassFish Community. All Rights Reserved.