| java.lang.Object |
| ↳ |
com.atlassian.plugin.servlet.PluginServletContextWrapper |
Class Overview
A wrapper around servlet context that allows plugin servlets to add
attributes which will not be shared/clobbered by other plugins.
Summary
|
[Expand]
Inherited Methods |
From class
java.lang.Object
|
Object
|
clone()
|
|
boolean
|
equals(Object arg0)
|
|
void
|
finalize()
|
|
final
Class<?>
|
getClass()
|
|
int
|
hashCode()
|
|
final
void
|
notify()
|
|
final
void
|
notifyAll()
|
|
String
|
toString()
|
|
final
void
|
wait()
|
|
final
void
|
wait(long arg0, int arg1)
|
|
final
void
|
wait(long arg0)
|
|
From interface
javax.servlet.ServletContext
|
abstract
Object
|
getAttribute(String arg0)
|
|
abstract
Enumeration
|
getAttributeNames()
|
|
abstract
ServletContext
|
getContext(String arg0)
|
|
abstract
String
|
getInitParameter(String arg0)
|
|
abstract
Enumeration
|
getInitParameterNames()
|
|
abstract
int
|
getMajorVersion()
|
|
abstract
String
|
getMimeType(String arg0)
|
|
abstract
int
|
getMinorVersion()
|
|
abstract
RequestDispatcher
|
getNamedDispatcher(String arg0)
|
|
abstract
String
|
getRealPath(String arg0)
|
|
abstract
RequestDispatcher
|
getRequestDispatcher(String arg0)
|
|
abstract
URL
|
getResource(String arg0)
|
|
abstract
InputStream
|
getResourceAsStream(String arg0)
|
|
abstract
Set
|
getResourcePaths(String arg0)
|
|
abstract
String
|
getServerInfo()
|
|
abstract
Servlet
|
getServlet(String arg0)
|
|
abstract
String
|
getServletContextName()
|
|
abstract
Enumeration
|
getServletNames()
|
|
abstract
Enumeration
|
getServlets()
|
|
abstract
void
|
log(String arg0, Throwable arg1)
|
|
abstract
void
|
log(Exception arg0, String arg1)
|
|
abstract
void
|
log(String arg0)
|
|
abstract
void
|
removeAttribute(String arg0)
|
|
abstract
void
|
setAttribute(String arg0, Object arg1)
|
|
Public Constructors
public
PluginServletContextWrapper
(Plugin plugin, ServletContext context, ConcurrentMap<String, Object> attributes, Map<String, String> initParams)
Public Methods
public
Object
getAttribute
(String name)
Gets the named attribute. The attribute is first looked for in the local
attribute map, if it is not found there it is looked for in the wrapped
contexts attribute map. If it is not there, null is returned.
A consequence of this ordering is that servlets may, in their own
context, override but not overwrite attributes from the wrapped context.
public
Enumeration
getAttributeNames
()
Returns
- an enumeration of all the attributes from the wrapped
context as well as the local attributes.
public
ServletContext
getContext
(String uripath)
Returns
- null so that servlet plugins can't escape their box
public
String
getContextPath
()
public
String
getInitParameter
(String name)
Returns
- the init parameter from the servlet module descriptor.
public
Enumeration
getInitParameterNames
()
Returns
- an enumeration of the init parameters from the servlet module
descriptor.
public
int
getMajorVersion
()
public
String
getMimeType
(String file)
public
int
getMinorVersion
()
public
RequestDispatcher
getNamedDispatcher
(String name)
public
String
getRealPath
(String path)
public
RequestDispatcher
getRequestDispatcher
(String path)
public
URL
getResource
(String path)
Returns
- the resource from the plugin classloader if it exists, otherwise the
resource is looked up from the wrapped context and returned
public
InputStream
getResourceAsStream
(String path)
Returns
- the resource stream from the plugin classloader if it exists, otherwise
the resource stream is attempted to be retrieved from the wrapped context
public
Set
getResourcePaths
(String arg0)
public
String
getServerInfo
()
public
Servlet
getServlet
(String name)
public
String
getServletContextName
()
public
Enumeration
getServletNames
()
public
Enumeration
getServlets
()
public
void
log
(String message, Throwable throwable)
public
void
log
(Exception exception, String msg)
public
void
log
(String msg)
public
void
removeAttribute
(String name)
Removes an attribute from the local context. Leaves the wrapped context
completely untouched.
public
void
setAttribute
(String name, Object object)
Sets an attribute in the local attribute map, leaving the wrapped
context untouched.
Servlets may use this and the lookup ordering of the
getAttribute() method to effectively override the value
of an attribute in the wrapped servlet context with their own value and
this overridden value will only be seen in the plugins own scope.