class ServletDefinition extends java.lang.Object implements ProviderWithExtensionVisitor<ServletDefinition>
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.AtomicReference<javax.servlet.http.HttpServlet> |
httpServlet |
private java.util.Map<java.lang.String,java.lang.String> |
initParams |
private UriPatternMatcher |
patternMatcher |
private javax.servlet.http.HttpServlet |
servletInstance |
private Key<? extends javax.servlet.http.HttpServlet> |
servletKey |
Constructor and Description |
---|
ServletDefinition(Key<? extends javax.servlet.http.HttpServlet> servletKey,
UriPatternMatcher patternMatcher,
java.util.Map<java.lang.String,java.lang.String> initParams,
javax.servlet.http.HttpServlet servletInstance) |
Modifier and Type | Method and Description |
---|---|
<B,V> V |
acceptExtensionVisitor(BindingTargetVisitor<B,V> visitor,
ProviderInstanceBinding<? extends B> binding)
Instructs the extension determine if the visitor is an instance of a custom extension visitor,
and if so, visit it using that method.
|
void |
destroy(java.util.Set<javax.servlet.http.HttpServlet> destroyedSoFar) |
(package private) void |
doService(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse)
Utility that delegates to the actual service method of the servlet wrapped with a contextual
request (i.e.
|
private void |
doServiceImpl(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
ServletDefinition |
get()
Provides an instance of
T . |
(package private) java.lang.String |
getKey() |
void |
init(javax.servlet.ServletContext servletContext,
Injector injector,
java.util.Set<javax.servlet.http.HttpServlet> initializedSoFar) |
boolean |
service(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse)
Wrapper around the service chain to ensure a servlet is servicing what it must and provides it
with a wrapped request.
|
(package private) boolean |
shouldServe(java.lang.String uri) |
private final Key<? extends javax.servlet.http.HttpServlet> servletKey
private final UriPatternMatcher patternMatcher
private final java.util.Map<java.lang.String,java.lang.String> initParams
private final javax.servlet.http.HttpServlet servletInstance
private final java.util.concurrent.atomic.AtomicReference<javax.servlet.http.HttpServlet> httpServlet
public ServletDefinition(Key<? extends javax.servlet.http.HttpServlet> servletKey, UriPatternMatcher patternMatcher, java.util.Map<java.lang.String,java.lang.String> initParams, javax.servlet.http.HttpServlet servletInstance)
public ServletDefinition get()
Provider
T
.get
in interface javax.inject.Provider<ServletDefinition>
public <B,V> V acceptExtensionVisitor(BindingTargetVisitor<B,V> visitor, ProviderInstanceBinding<? extends B> binding)
ProviderWithExtensionVisitor
Due to issues with generics, the type parameters of this method do not relate to the type of the provider. In practice, the 'B' type will always be a supertype of 'T'.
acceptExtensionVisitor
in interface ProviderWithExtensionVisitor<ServletDefinition>
boolean shouldServe(java.lang.String uri)
public void init(javax.servlet.ServletContext servletContext, Injector injector, java.util.Set<javax.servlet.http.HttpServlet> initializedSoFar) throws javax.servlet.ServletException
javax.servlet.ServletException
public void destroy(java.util.Set<javax.servlet.http.HttpServlet> destroyedSoFar)
public boolean service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
- If thrown by underlying servletjavax.servlet.ServletException
- If thrown by underlying servletvoid doService(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws javax.servlet.ServletException, java.io.IOException
We need to suppress deprecation coz we use HttpServletRequestWrapper, which implements deprecated API for backwards compatibility.
javax.servlet.ServletException
java.io.IOException
private void doServiceImpl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.ServletException
java.io.IOException
java.lang.String getKey()