Package net.officefloor.servlet
Interface ServletManager
-
- All Known Implementing Classes:
TomcatServletManager
public interface ServletManager
Manager ofServlet
instances forServletServicer
.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FilterServicer
addFilter(java.lang.String name, java.lang.Class<? extends javax.servlet.Filter> filterClass, java.util.function.Consumer<org.apache.tomcat.util.descriptor.web.FilterDef> decorator)
Adds aFilter
.ServletServicer
addServlet(java.lang.String name, java.lang.Class<? extends javax.servlet.Servlet> servletClass, java.util.function.Consumer<org.apache.catalina.Wrapper> decorator)
Adds aServlet
.ServletServicer
addServlet(java.lang.String name, javax.servlet.Servlet servlet, boolean isInjectDependencies, java.util.function.Consumer<org.apache.catalina.Wrapper> decorator)
Adds aServlet
instance.void
chainInServletManager()
Chains in thisServletManager
to service HTTP requests.AvailableType[]
getAvailableTypes()
Obtains theAvailableType
instances fromOfficeFloor
.org.apache.catalina.Context
getContext()
Obtains theContext
.<T> T
getDependency(java.lang.String qualifier, java.lang.Class<? extends T> type)
Obtains a dependency.OfficeExtensionContext
getSourceContext()
Obtains theOfficeExtensionContext
.
-
-
-
Method Detail
-
getContext
org.apache.catalina.Context getContext()
Obtains theContext
.- Returns:
Context
.
-
addServlet
ServletServicer addServlet(java.lang.String name, java.lang.Class<? extends javax.servlet.Servlet> servletClass, java.util.function.Consumer<org.apache.catalina.Wrapper> decorator)
Adds aServlet
.- Parameters:
name
- Name ofServlet
.servletClass
-Servlet
Class
.decorator
- Decorates theServlet
. May benull
.- Returns:
ServletServicer
.
-
addServlet
ServletServicer addServlet(java.lang.String name, javax.servlet.Servlet servlet, boolean isInjectDependencies, java.util.function.Consumer<org.apache.catalina.Wrapper> decorator)
Adds aServlet
instance.- Parameters:
name
- Name ofServlet
.servlet
-Servlet
.isInjectDependencies
- Flags to inject dependencies into theServlet
instance.decorator
- Decorates theServlet
. May benull
.- Returns:
ServletServicer
.
-
addFilter
FilterServicer addFilter(java.lang.String name, java.lang.Class<? extends javax.servlet.Filter> filterClass, java.util.function.Consumer<org.apache.tomcat.util.descriptor.web.FilterDef> decorator)
Adds aFilter
.- Parameters:
name
- Name ofFilter
.filterClass
-Filter
Class
.decorator
- Decorates theFilter
. May benull
.- Returns:
FilterServicer
.
-
getDependency
<T> T getDependency(java.lang.String qualifier, java.lang.Class<? extends T> type)
Obtains a dependency.
The dependency is via a
SupplierThreadLocal
that is always available in servicing aServlet
/Filter
.- Type Parameters:
T
- Type of dependency.- Parameters:
qualifier
- Qualifier. May benull
.type
- Type.- Returns:
- Dependency.
-
getAvailableTypes
AvailableType[] getAvailableTypes() throws java.lang.IllegalStateException
Obtains the
AvailableType
instances fromOfficeFloor
.This should only be invoked during
Servlet
container startup.- Returns:
AvailableType
instances fromOfficeFloor
.- Throws:
java.lang.IllegalStateException
- If invoked before completion ofServletSupplierSource
.
-
chainInServletManager
void chainInServletManager()
Chains in thisServletManager
to service HTTP requests. This allows the backingServlet
container to route requests to the appropriateFilter
/Servlet
to service the HTTP request.
-
getSourceContext
OfficeExtensionContext getSourceContext()
Obtains theOfficeExtensionContext
.- Returns:
OfficeExtensionContext
.
-
-