Class PluginServletContext
- java.lang.Object
-
- org.jivesoftware.openfire.container.PluginServletContext
-
- All Implemented Interfaces:
javax.servlet.ServletContext
public class PluginServletContext extends Object implements javax.servlet.ServletContext
A Servlet Context to be used by Openfire plugins. This implementation is used do load resources from the plugin classpath. Other functionality is delegated to a proxy implementation.- Author:
- Guus der Kinderen, guus.der.kinderen@gmail.com
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.servlet.ServletContext
proxy
-
Constructor Summary
Constructors Constructor Description PluginServletContext(javax.servlet.ServletContext proxy, PluginManager pluginManager, Plugin plugin)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.servlet.FilterRegistration.Dynamic
addFilter(String s, Class<? extends javax.servlet.Filter> aClass)
javax.servlet.FilterRegistration.Dynamic
addFilter(String s, String s1)
javax.servlet.FilterRegistration.Dynamic
addFilter(String s, javax.servlet.Filter filter)
javax.servlet.ServletRegistration.Dynamic
addJspFile(String servletName, String jspFile)
void
addListener(Class<? extends EventListener> aClass)
void
addListener(String s)
<T extends EventListener>
voidaddListener(T t)
javax.servlet.ServletRegistration.Dynamic
addServlet(String s, Class<? extends javax.servlet.Servlet> aClass)
javax.servlet.ServletRegistration.Dynamic
addServlet(String s, String s1)
javax.servlet.ServletRegistration.Dynamic
addServlet(String s, javax.servlet.Servlet servlet)
<T extends javax.servlet.Filter>
TcreateFilter(Class<T> aClass)
<T extends EventListener>
TcreateListener(Class<T> aClass)
<T extends javax.servlet.Servlet>
TcreateServlet(Class<T> aClass)
void
declareRoles(String... strings)
Object
getAttribute(String s)
Enumeration<String>
getAttributeNames()
ClassLoader
getClassLoader()
javax.servlet.ServletContext
getContext(String s)
String
getContextPath()
Set<javax.servlet.SessionTrackingMode>
getDefaultSessionTrackingModes()
int
getEffectiveMajorVersion()
int
getEffectiveMinorVersion()
Set<javax.servlet.SessionTrackingMode>
getEffectiveSessionTrackingModes()
javax.servlet.FilterRegistration
getFilterRegistration(String s)
Map<String,? extends javax.servlet.FilterRegistration>
getFilterRegistrations()
String
getInitParameter(String s)
Enumeration<String>
getInitParameterNames()
javax.servlet.descriptor.JspConfigDescriptor
getJspConfigDescriptor()
int
getMajorVersion()
String
getMimeType(String s)
int
getMinorVersion()
javax.servlet.RequestDispatcher
getNamedDispatcher(String s)
String
getRealPath(String s)
String
getRequestCharacterEncoding()
javax.servlet.RequestDispatcher
getRequestDispatcher(String s)
URL
getResource(String s)
InputStream
getResourceAsStream(String s)
Set<String>
getResourcePaths(String s)
String
getResponseCharacterEncoding()
String
getServerInfo()
javax.servlet.Servlet
getServlet(String s)
String
getServletContextName()
Enumeration<String>
getServletNames()
javax.servlet.ServletRegistration
getServletRegistration(String s)
Map<String,? extends javax.servlet.ServletRegistration>
getServletRegistrations()
Enumeration<javax.servlet.Servlet>
getServlets()
javax.servlet.SessionCookieConfig
getSessionCookieConfig()
int
getSessionTimeout()
String
getVirtualServerName()
void
log(Exception e, String s)
void
log(String s)
void
log(String s, Throwable throwable)
void
removeAttribute(String s)
void
setAttribute(String s, Object o)
boolean
setInitParameter(String s, String s1)
void
setRequestCharacterEncoding(String encoding)
void
setResponseCharacterEncoding(String encoding)
void
setSessionTimeout(int sessionTimeout)
void
setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> set)
protected static String
stripLeadingSlash(String input)
The plugin classloader is an URL classloadeer, which will do lookups in directories with entries like these: jar:file:/home/guus/github/Openfire/target/openfire/plugins/oauthresourceserver/lib/plugin-oauthresourceserver.jar!/ (note the trailing slash).
-
-
-
Constructor Detail
-
PluginServletContext
public PluginServletContext(javax.servlet.ServletContext proxy, PluginManager pluginManager, Plugin plugin)
-
-
Method Detail
-
stripLeadingSlash
protected static String stripLeadingSlash(String input)
The plugin classloader is an URL classloadeer, which will do lookups in directories with entries like these: jar:file:/home/guus/github/Openfire/target/openfire/plugins/oauthresourceserver/lib/plugin-oauthresourceserver.jar!/ (note the trailing slash). To prevent lookup failures, strip any leading slash (which, when concatinated, would result "//").- Parameters:
input
- A string (cannot be null)- Returns:
- The string without the first leading slash.
-
getContextPath
public String getContextPath()
- Specified by:
getContextPath
in interfacejavax.servlet.ServletContext
-
getContext
public javax.servlet.ServletContext getContext(String s)
- Specified by:
getContext
in interfacejavax.servlet.ServletContext
-
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersion
in interfacejavax.servlet.ServletContext
-
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersion
in interfacejavax.servlet.ServletContext
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()
- Specified by:
getEffectiveMajorVersion
in interfacejavax.servlet.ServletContext
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()
- Specified by:
getEffectiveMinorVersion
in interfacejavax.servlet.ServletContext
-
getMimeType
public String getMimeType(String s)
- Specified by:
getMimeType
in interfacejavax.servlet.ServletContext
-
getResourcePaths
public Set<String> getResourcePaths(String s)
- Specified by:
getResourcePaths
in interfacejavax.servlet.ServletContext
-
getResource
public URL getResource(String s) throws MalformedURLException
- Specified by:
getResource
in interfacejavax.servlet.ServletContext
- Throws:
MalformedURLException
-
getResourceAsStream
public InputStream getResourceAsStream(String s)
- Specified by:
getResourceAsStream
in interfacejavax.servlet.ServletContext
-
getRequestDispatcher
public javax.servlet.RequestDispatcher getRequestDispatcher(String s)
- Specified by:
getRequestDispatcher
in interfacejavax.servlet.ServletContext
-
getNamedDispatcher
public javax.servlet.RequestDispatcher getNamedDispatcher(String s)
- Specified by:
getNamedDispatcher
in interfacejavax.servlet.ServletContext
-
getServlet
public javax.servlet.Servlet getServlet(String s) throws javax.servlet.ServletException
- Specified by:
getServlet
in interfacejavax.servlet.ServletContext
- Throws:
javax.servlet.ServletException
-
getServlets
public Enumeration<javax.servlet.Servlet> getServlets()
- Specified by:
getServlets
in interfacejavax.servlet.ServletContext
-
getServletNames
public Enumeration<String> getServletNames()
- Specified by:
getServletNames
in interfacejavax.servlet.ServletContext
-
log
public void log(String s)
- Specified by:
log
in interfacejavax.servlet.ServletContext
-
log
public void log(Exception e, String s)
- Specified by:
log
in interfacejavax.servlet.ServletContext
-
log
public void log(String s, Throwable throwable)
- Specified by:
log
in interfacejavax.servlet.ServletContext
-
getRealPath
public String getRealPath(String s)
- Specified by:
getRealPath
in interfacejavax.servlet.ServletContext
-
getServerInfo
public String getServerInfo()
- Specified by:
getServerInfo
in interfacejavax.servlet.ServletContext
-
getInitParameter
public String getInitParameter(String s)
- Specified by:
getInitParameter
in interfacejavax.servlet.ServletContext
-
getInitParameterNames
public Enumeration<String> getInitParameterNames()
- Specified by:
getInitParameterNames
in interfacejavax.servlet.ServletContext
-
setInitParameter
public boolean setInitParameter(String s, String s1)
- Specified by:
setInitParameter
in interfacejavax.servlet.ServletContext
-
getAttribute
public Object getAttribute(String s)
- Specified by:
getAttribute
in interfacejavax.servlet.ServletContext
-
getAttributeNames
public Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNames
in interfacejavax.servlet.ServletContext
-
setAttribute
public void setAttribute(String s, Object o)
- Specified by:
setAttribute
in interfacejavax.servlet.ServletContext
-
removeAttribute
public void removeAttribute(String s)
- Specified by:
removeAttribute
in interfacejavax.servlet.ServletContext
-
getServletContextName
public String getServletContextName()
- Specified by:
getServletContextName
in interfacejavax.servlet.ServletContext
-
addServlet
public javax.servlet.ServletRegistration.Dynamic addServlet(String s, String s1)
- Specified by:
addServlet
in interfacejavax.servlet.ServletContext
-
addServlet
public javax.servlet.ServletRegistration.Dynamic addServlet(String s, javax.servlet.Servlet servlet)
- Specified by:
addServlet
in interfacejavax.servlet.ServletContext
-
addServlet
public javax.servlet.ServletRegistration.Dynamic addServlet(String s, Class<? extends javax.servlet.Servlet> aClass)
- Specified by:
addServlet
in interfacejavax.servlet.ServletContext
-
addJspFile
public javax.servlet.ServletRegistration.Dynamic addJspFile(String servletName, String jspFile)
- Specified by:
addJspFile
in interfacejavax.servlet.ServletContext
-
createServlet
public <T extends javax.servlet.Servlet> T createServlet(Class<T> aClass) throws javax.servlet.ServletException
- Specified by:
createServlet
in interfacejavax.servlet.ServletContext
- Throws:
javax.servlet.ServletException
-
getServletRegistration
public javax.servlet.ServletRegistration getServletRegistration(String s)
- Specified by:
getServletRegistration
in interfacejavax.servlet.ServletContext
-
getServletRegistrations
public Map<String,? extends javax.servlet.ServletRegistration> getServletRegistrations()
- Specified by:
getServletRegistrations
in interfacejavax.servlet.ServletContext
-
addFilter
public javax.servlet.FilterRegistration.Dynamic addFilter(String s, String s1)
- Specified by:
addFilter
in interfacejavax.servlet.ServletContext
-
addFilter
public javax.servlet.FilterRegistration.Dynamic addFilter(String s, javax.servlet.Filter filter)
- Specified by:
addFilter
in interfacejavax.servlet.ServletContext
-
addFilter
public javax.servlet.FilterRegistration.Dynamic addFilter(String s, Class<? extends javax.servlet.Filter> aClass)
- Specified by:
addFilter
in interfacejavax.servlet.ServletContext
-
createFilter
public <T extends javax.servlet.Filter> T createFilter(Class<T> aClass) throws javax.servlet.ServletException
- Specified by:
createFilter
in interfacejavax.servlet.ServletContext
- Throws:
javax.servlet.ServletException
-
getFilterRegistration
public javax.servlet.FilterRegistration getFilterRegistration(String s)
- Specified by:
getFilterRegistration
in interfacejavax.servlet.ServletContext
-
getFilterRegistrations
public Map<String,? extends javax.servlet.FilterRegistration> getFilterRegistrations()
- Specified by:
getFilterRegistrations
in interfacejavax.servlet.ServletContext
-
getSessionCookieConfig
public javax.servlet.SessionCookieConfig getSessionCookieConfig()
- Specified by:
getSessionCookieConfig
in interfacejavax.servlet.ServletContext
-
setSessionTrackingModes
public void setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> set)
- Specified by:
setSessionTrackingModes
in interfacejavax.servlet.ServletContext
-
getDefaultSessionTrackingModes
public Set<javax.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
- Specified by:
getDefaultSessionTrackingModes
in interfacejavax.servlet.ServletContext
-
getEffectiveSessionTrackingModes
public Set<javax.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
- Specified by:
getEffectiveSessionTrackingModes
in interfacejavax.servlet.ServletContext
-
addListener
public void addListener(String s)
- Specified by:
addListener
in interfacejavax.servlet.ServletContext
-
addListener
public <T extends EventListener> void addListener(T t)
- Specified by:
addListener
in interfacejavax.servlet.ServletContext
-
addListener
public void addListener(Class<? extends EventListener> aClass)
- Specified by:
addListener
in interfacejavax.servlet.ServletContext
-
createListener
public <T extends EventListener> T createListener(Class<T> aClass) throws javax.servlet.ServletException
- Specified by:
createListener
in interfacejavax.servlet.ServletContext
- Throws:
javax.servlet.ServletException
-
getJspConfigDescriptor
public javax.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()
- Specified by:
getJspConfigDescriptor
in interfacejavax.servlet.ServletContext
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoader
in interfacejavax.servlet.ServletContext
-
declareRoles
public void declareRoles(String... strings)
- Specified by:
declareRoles
in interfacejavax.servlet.ServletContext
-
getVirtualServerName
public String getVirtualServerName()
- Specified by:
getVirtualServerName
in interfacejavax.servlet.ServletContext
-
getSessionTimeout
public int getSessionTimeout()
- Specified by:
getSessionTimeout
in interfacejavax.servlet.ServletContext
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)
- Specified by:
setSessionTimeout
in interfacejavax.servlet.ServletContext
-
getRequestCharacterEncoding
public String getRequestCharacterEncoding()
- Specified by:
getRequestCharacterEncoding
in interfacejavax.servlet.ServletContext
-
setRequestCharacterEncoding
public void setRequestCharacterEncoding(String encoding)
- Specified by:
setRequestCharacterEncoding
in interfacejavax.servlet.ServletContext
-
getResponseCharacterEncoding
public String getResponseCharacterEncoding()
- Specified by:
getResponseCharacterEncoding
in interfacejavax.servlet.ServletContext
-
setResponseCharacterEncoding
public void setResponseCharacterEncoding(String encoding)
- Specified by:
setResponseCharacterEncoding
in interfacejavax.servlet.ServletContext
-
-