Package net.officefloor.servlet.supply
Class ServletSupplierSource
- java.lang.Object
-
- net.officefloor.compile.spi.supplier.source.impl.AbstractSupplierSource
-
- net.officefloor.servlet.supply.ServletSupplierSource
-
- All Implemented Interfaces:
SupplierSource
public class ServletSupplierSource extends AbstractSupplierSource
SupplierSourceto provideServletfunctionality.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.compile.spi.supplier.source.impl.AbstractSupplierSource
AbstractSupplierSource.SpecificationContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROPERTY_CHAIN_SERVLETSPropertyname to chain theServletManagerin to serviceHttpRequestinstances viaFilter/Servletmappings.
-
Constructor Summary
Constructors Constructor Description ServletSupplierSource(TomcatServletManager servletContainer, InjectionRegistry injectionRegistry)Instantiate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ServletServicerforceStartServletContainer(AvailableType[] availableTypes)Force starts theServletcontainer.static ServletManagergetServletManager()Obtains theServletManager.protected voidloadSpecification(AbstractSupplierSource.SpecificationContext context)Loads theSupplierSourceSpecification.static voidregisterForInjection(java.lang.String className)Registers theClassfor injection.static voidsendError(java.lang.Throwable failure, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Sends an error.voidsupply(SupplierSourceContext context)Supplies the necessaryManagedObjectSourceinstances.voidterminate()Terminates the supply contract.-
Methods inherited from class net.officefloor.compile.spi.supplier.source.impl.AbstractSupplierSource
getSpecification
-
-
-
-
Field Detail
-
PROPERTY_CHAIN_SERVLETS
public static final java.lang.String PROPERTY_CHAIN_SERVLETS
Propertyname to chain theServletManagerin to serviceHttpRequestinstances viaFilter/Servletmappings.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServletSupplierSource
public ServletSupplierSource(TomcatServletManager servletContainer, InjectionRegistry injectionRegistry)
Instantiate.- Parameters:
servletContainer-TomcatServletManager.injectionRegistry-InjectionRegistry.
-
-
Method Detail
-
getServletManager
public static ServletManager getServletManager()
Obtains theServletManager.- Returns:
ServletManager.
-
sendError
public static void sendError(java.lang.Throwable failure, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOExceptionSends an error.
The
Throwablewill (in most cases) be reported back toOfficeFloorfor appropriateExceptionresponse. If not possible, an appropriateExceptionmessage is also provided.- Parameters:
failure- Failure.request-HttpServletRequest.response-HttpServletResponse.- Throws:
java.io.IOException- If fails to send error.
-
registerForInjection
public static void registerForInjection(java.lang.String className) throws java.lang.ExceptionRegisters theClassfor injection.- Parameters:
className-Classname.- Throws:
java.lang.Exception- If fails to register for injection.
-
forceStartServletContainer
public static ServletServicer forceStartServletContainer(AvailableType[] availableTypes) throws java.lang.Exception
Force starts theServletcontainer.- Parameters:
availableTypes-AvailableTypeinstances.- Returns:
ServletServicerto theServletcontainer.- Throws:
java.lang.Exception- If fails to startServletcontainer.
-
loadSpecification
protected void loadSpecification(AbstractSupplierSource.SpecificationContext context)
Description copied from class:AbstractSupplierSourceLoads theSupplierSourceSpecification.- Specified by:
loadSpecificationin classAbstractSupplierSource- Parameters:
context-AbstractSupplierSource.SpecificationContext.
-
supply
public void supply(SupplierSourceContext context) throws java.lang.Exception
Description copied from interface:SupplierSourceSupplies the necessaryManagedObjectSourceinstances.- Parameters:
context-SupplierSourceContext.- Throws:
java.lang.Exception- If fails to provide supply ofManagedObjectSourceinstances.
-
terminate
public void terminate()
Description copied from interface:SupplierSourceTerminates the supply contract.
This should release all resources required by the supplier.
-
-