Package net.officefloor.web.state
Class HttpApplicationStateManagedObjectSource
- java.lang.Object
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource<O,F>
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource<None,None>
-
- net.officefloor.web.state.HttpApplicationStateManagedObjectSource
-
- All Implemented Interfaces:
ManagedObject
,ManagedObjectSource<None,None>
,HttpApplicationState
@PrivateSource public class HttpApplicationStateManagedObjectSource extends AbstractManagedObjectSource<None,None> implements ManagedObject, HttpApplicationState
ManagedObjectSource
for theHttpRequestState
.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
AbstractAsyncManagedObjectSource.DependencyLabeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.ExecutionLabeller, AbstractAsyncManagedObjectSource.Labeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.MetaDataContext<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>, AbstractAsyncManagedObjectSource.SpecificationContext
-
-
Constructor Summary
Constructors Constructor Description HttpApplicationStateManagedObjectSource(java.lang.String contextPath)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
createApplicationClientPath(java.lang.String path)
Creates the client path for this application.java.lang.String
createApplicationClientUrl(boolean isSecure, java.lang.String path, ServerHttpConnection connection)
Creates the client URL for this application.java.lang.String
extractApplicationPath(ServerHttpConnection connection)
Extracts the application path from theHttpRequest
.java.lang.Object
getAttribute(java.lang.String name)
Obtains theObject
that is bound to the name.java.util.Iterator<java.lang.String>
getAttributeNames()
Obtains anIterator
to the names of the boundObject
instances.java.lang.String
getContextPath()
Obtains the context path for the application.protected ManagedObject
getManagedObject()
Synchronously obtains theManagedObject
.java.lang.Object
getObject()
Obtains the object being managed.protected void
loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,None> context)
Overridden to load meta-data.protected void
loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Overridden to load specifications.void
removeAttribute(java.lang.String name)
Removes the boundObject
by the name.void
setAttribute(java.lang.String name, java.lang.Object object)
Binds theObject
to the name.-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource
sourceManagedObject
-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
getSpecification, init, start, stop
-
-
-
-
Method Detail
-
loadSpecification
protected void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Description copied from class:AbstractAsyncManagedObjectSource
Overridden to load specifications.- Specified by:
loadSpecification
in classAbstractAsyncManagedObjectSource<None,None>
- Parameters:
context
- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,None> context) throws java.lang.Exception
Description copied from class:AbstractAsyncManagedObjectSource
Overridden to load meta-data.- Specified by:
loadMetaData
in classAbstractAsyncManagedObjectSource<None,None>
- Parameters:
context
- Meta-data.- Throws:
java.lang.Exception
- If fails to load the meta-data.
-
getManagedObject
protected ManagedObject getManagedObject() throws java.lang.Throwable
Description copied from class:AbstractManagedObjectSource
Synchronously obtains theManagedObject
.- Specified by:
getManagedObject
in classAbstractManagedObjectSource<None,None>
- Returns:
ManagedObject
.- Throws:
java.lang.Throwable
- If fails to obtain theManagedObject
.
-
getObject
public java.lang.Object getObject() throws java.lang.Throwable
Description copied from interface:ManagedObject
Obtains the object being managed.- Specified by:
getObject
in interfaceManagedObject
- Returns:
- Object being managed.
- Throws:
java.lang.Throwable
- Indicating failed to obtain the object for use.
-
getContextPath
public java.lang.String getContextPath()
Description copied from interface:HttpApplicationState
Obtains the context path for the application.- Specified by:
getContextPath
in interfaceHttpApplicationState
- Returns:
- Context path for the application.
-
createApplicationClientUrl
public java.lang.String createApplicationClientUrl(boolean isSecure, java.lang.String path, ServerHttpConnection connection)
Description copied from interface:HttpApplicationState
Creates the client URL for this application.
This includes
protocol
,domain
andport
.- Specified by:
createApplicationClientUrl
in interfaceHttpApplicationState
- Parameters:
isSecure
- Indicates if the URL is secure.path
- Path including query string and fragment for the URL.connection
-ServerHttpConnection
.- Returns:
- Client URL for the application.
-
createApplicationClientPath
public java.lang.String createApplicationClientPath(java.lang.String path)
Description copied from interface:HttpApplicationState
Creates the client path for this application.
This is the public path on the server, and does NOT
protocol
,domain
norport
.- Specified by:
createApplicationClientPath
in interfaceHttpApplicationState
- Parameters:
path
- Path including query string and fragment for the path.- Returns:
- Client path for the application.
-
extractApplicationPath
public java.lang.String extractApplicationPath(ServerHttpConnection connection) throws HttpException
Description copied from interface:HttpApplicationState
Extracts the application path from theHttpRequest
.- Specified by:
extractApplicationPath
in interfaceHttpApplicationState
- Parameters:
connection
-ServerHttpConnection
.- Returns:
- Application path.
- Throws:
HttpException
- If invalid path for this application.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface:HttpApplicationState
Obtains theObject
that is bound to the name.- Specified by:
getAttribute
in interfaceHttpApplicationState
- Parameters:
name
- Name.- Returns:
Object
bound to the name ornull
if noObject
bound by the name.
-
getAttributeNames
public java.util.Iterator<java.lang.String> getAttributeNames()
Description copied from interface:HttpApplicationState
Obtains anIterator
to the names of the boundObject
instances.- Specified by:
getAttributeNames
in interfaceHttpApplicationState
- Returns:
Iterator
to the names of the boundObject
instances.
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object object)
Description copied from interface:HttpApplicationState
Binds theObject
to the name.- Specified by:
setAttribute
in interfaceHttpApplicationState
- Parameters:
name
- Name.object
-Object
.
-
removeAttribute
public void removeAttribute(java.lang.String name)
Description copied from interface:HttpApplicationState
Removes the boundObject
by the name.- Specified by:
removeAttribute
in interfaceHttpApplicationState
- Parameters:
name
- Name of boundObject
to remove.
-
-