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
SupplierSource to provide Servlet functionality.- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested classes/interfaces inherited from class net.officefloor.compile.spi.supplier.source.impl.AbstractSupplierSource
AbstractSupplierSource.SpecificationContext -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPropertyname to chain theServletManagerin to serviceHttpRequestinstances viaFilter/Servletmappings. -
Constructor Summary
ConstructorsConstructorDescriptionServletSupplierSource(TomcatServletManager servletContainer, InjectionRegistry injectionRegistry) Instantiate. -
Method Summary
Modifier and TypeMethodDescriptionstatic ServletServicerforceStartServletContainer(AvailableType[] availableTypes) Force starts theServletcontainer.static ServletManagerObtains theServletManager.protected voidLoads theSupplierSourceSpecification.static voidregisterForInjection(String className) Registers theClassfor injection.static voidsendError(Throwable failure, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Sends an error.voidsupply(SupplierSourceContext context) Supplies the necessaryManagedObjectSourceinstances.voidTerminates the supply contract.Methods inherited from class net.officefloor.compile.spi.supplier.source.impl.AbstractSupplierSource
getSpecification
-
Field Details
-
PROPERTY_CHAIN_SERVLETS
Propertyname to chain theServletManagerin to serviceHttpRequestinstances viaFilter/Servletmappings.- See Also:
-
-
Constructor Details
-
ServletSupplierSource
public ServletSupplierSource(TomcatServletManager servletContainer, InjectionRegistry injectionRegistry) Instantiate.- Parameters:
servletContainer-TomcatServletManager.injectionRegistry-InjectionRegistry.
-
-
Method Details
-
getServletManager
Obtains theServletManager.- Returns:
ServletManager.
-
sendError
public static void sendError(Throwable failure, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException Sends 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:
IOException- If fails to send error.
-
registerForInjection
Registers theClassfor injection. -
forceStartServletContainer
public static ServletServicer forceStartServletContainer(AvailableType[] availableTypes) throws Exception Force starts theServletcontainer.- Parameters:
availableTypes-AvailableTypeinstances.- Returns:
ServletServicerto theServletcontainer.- Throws:
Exception- If fails to startServletcontainer.
-
loadSpecification
Description copied from class:AbstractSupplierSourceLoads theSupplierSourceSpecification.- Specified by:
loadSpecificationin classAbstractSupplierSource- Parameters:
context-AbstractSupplierSource.SpecificationContext.
-
supply
Description copied from interface:SupplierSourceSupplies the necessaryManagedObjectSourceinstances.- Parameters:
context-SupplierSourceContext.- Throws:
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.
-