Package org.eclipse.jetty.servlet
Class DecoratingListener
- java.lang.Object
-
- org.eclipse.jetty.servlet.DecoratingListener
-
- All Implemented Interfaces:
java.util.EventListener
,javax.servlet.ServletContextAttributeListener
- Direct Known Subclasses:
CdiDecoratingListener
,DecoratingListener
public class DecoratingListener extends java.lang.Object implements javax.servlet.ServletContextAttributeListener
A ServletContextAttributeListener that listens for a context attribute to obtain a decorator instance. The instance is then either coerced to aDecorator
or reflected for decorator compatible methods so it can be added to theServletContextHandler.getObjectFactory()
as aDecorator
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DecoratingListener.DynamicDecorator
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
_attributeName
private ServletContextHandler
_context
private Decorator
_decorator
private static java.lang.invoke.MethodType
DECORATE_TYPE
private static java.lang.invoke.MethodType
DESTROY_TYPE
-
Constructor Summary
Constructors Constructor Description DecoratingListener(ServletContextHandler context, java.lang.String attributeName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Decorator
asDecorator(java.lang.Object object)
void
attributeAdded(javax.servlet.ServletContextAttributeEvent event)
void
attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
void
attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
java.lang.String
getAttributeName()
javax.servlet.ServletContext
getServletContext()
-
-
-
Field Detail
-
DECORATE_TYPE
private static final java.lang.invoke.MethodType DECORATE_TYPE
-
DESTROY_TYPE
private static final java.lang.invoke.MethodType DESTROY_TYPE
-
_context
private final ServletContextHandler _context
-
_attributeName
private final java.lang.String _attributeName
-
_decorator
private Decorator _decorator
-
-
Constructor Detail
-
DecoratingListener
public DecoratingListener(ServletContextHandler context, java.lang.String attributeName)
-
-
Method Detail
-
getAttributeName
public java.lang.String getAttributeName()
-
getServletContext
public javax.servlet.ServletContext getServletContext()
-
asDecorator
private Decorator asDecorator(java.lang.Object object)
-
attributeAdded
public void attributeAdded(javax.servlet.ServletContextAttributeEvent event)
- Specified by:
attributeAdded
in interfacejavax.servlet.ServletContextAttributeListener
-
attributeRemoved
public void attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
- Specified by:
attributeRemoved
in interfacejavax.servlet.ServletContextAttributeListener
-
attributeReplaced
public void attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
- Specified by:
attributeReplaced
in interfacejavax.servlet.ServletContextAttributeListener
-
-