Package io.milton.context
Class RequestContext
java.lang.Object
io.milton.context.Context
io.milton.context.RequestContext
- All Implemented Interfaces:
Contextual,RemovalCallback
-
Field Summary
Fields inherited from class io.milton.context.Context
itemByClass, itemByName -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TFor convenience, equivalent to RequestContext.getCurrent().get(c) This method assumes that the requested class is required and will throw an exception if it is not foundstatic <T> TFor convenience, equivalent to RequestContext.getCurrent().get(c) Returns the object in context of the given type or null if not found and required is false.static RequestContextstatic RequestContextgetInstance(RootContext parent) protected RegistrationgetOrCreateRegistration(Class c, Context context) protected Registrationprotected RegistrationvoidCalled when this request context goes out of context.static RequestContext
-
Method Details
-
C
For convenience, equivalent to RequestContext.getCurrent().get(c) This method assumes that the requested class is required and will throw an exception if it is not found- Type Parameters:
T- - the type expected to be returned- Parameters:
c- - the class to- Returns:
- - an object of the given type
- Throws:
ClassNotInContextException
-
C
For convenience, equivalent to RequestContext.getCurrent().get(c) Returns the object in context of the given type or null if not found and required is false.- Type Parameters:
T-- Parameters:
c-required- - if true will throw an exception if the requested class is not found. Otherwise will return null.- Returns:
- - an object of the given type
- Throws:
ClassNotInContextException
-
getCurrent
-
getInstance
-
peekInstance
-
getRootContext
-
getRegistration
- Overrides:
getRegistrationin classContext
-
getRegistration
- Overrides:
getRegistrationin classContext
-
getOrCreateRegistration
-
onRemove
Called when this request context goes out of context. Should shutdown all of its contents- Specified by:
onRemovein interfaceRemovalCallback
-