Class 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 Detail

      • proxy

        protected final javax.servlet.ServletContext proxy
    • 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 interface javax.servlet.ServletContext
      • getContext

        public javax.servlet.ServletContext getContext​(String s)
        Specified by:
        getContext in interface javax.servlet.ServletContext
      • getMajorVersion

        public int getMajorVersion()
        Specified by:
        getMajorVersion in interface javax.servlet.ServletContext
      • getMinorVersion

        public int getMinorVersion()
        Specified by:
        getMinorVersion in interface javax.servlet.ServletContext
      • getEffectiveMajorVersion

        public int getEffectiveMajorVersion()
        Specified by:
        getEffectiveMajorVersion in interface javax.servlet.ServletContext
      • getEffectiveMinorVersion

        public int getEffectiveMinorVersion()
        Specified by:
        getEffectiveMinorVersion in interface javax.servlet.ServletContext
      • getMimeType

        public String getMimeType​(String s)
        Specified by:
        getMimeType in interface javax.servlet.ServletContext
      • getResourcePaths

        public Set<String> getResourcePaths​(String s)
        Specified by:
        getResourcePaths in interface javax.servlet.ServletContext
      • getResourceAsStream

        public InputStream getResourceAsStream​(String s)
        Specified by:
        getResourceAsStream in interface javax.servlet.ServletContext
      • getRequestDispatcher

        public javax.servlet.RequestDispatcher getRequestDispatcher​(String s)
        Specified by:
        getRequestDispatcher in interface javax.servlet.ServletContext
      • getNamedDispatcher

        public javax.servlet.RequestDispatcher getNamedDispatcher​(String s)
        Specified by:
        getNamedDispatcher in interface javax.servlet.ServletContext
      • getServlet

        public javax.servlet.Servlet getServlet​(String s)
                                         throws javax.servlet.ServletException
        Specified by:
        getServlet in interface javax.servlet.ServletContext
        Throws:
        javax.servlet.ServletException
      • getServlets

        public Enumeration<javax.servlet.Servlet> getServlets()
        Specified by:
        getServlets in interface javax.servlet.ServletContext
      • getServletNames

        public Enumeration<String> getServletNames()
        Specified by:
        getServletNames in interface javax.servlet.ServletContext
      • log

        public void log​(String s)
        Specified by:
        log in interface javax.servlet.ServletContext
      • log

        public void log​(Exception e,
                        String s)
        Specified by:
        log in interface javax.servlet.ServletContext
      • log

        public void log​(String s,
                        Throwable throwable)
        Specified by:
        log in interface javax.servlet.ServletContext
      • getRealPath

        public String getRealPath​(String s)
        Specified by:
        getRealPath in interface javax.servlet.ServletContext
      • getServerInfo

        public String getServerInfo()
        Specified by:
        getServerInfo in interface javax.servlet.ServletContext
      • getInitParameter

        public String getInitParameter​(String s)
        Specified by:
        getInitParameter in interface javax.servlet.ServletContext
      • getInitParameterNames

        public Enumeration<String> getInitParameterNames()
        Specified by:
        getInitParameterNames in interface javax.servlet.ServletContext
      • setInitParameter

        public boolean setInitParameter​(String s,
                                        String s1)
        Specified by:
        setInitParameter in interface javax.servlet.ServletContext
      • getAttribute

        public Object getAttribute​(String s)
        Specified by:
        getAttribute in interface javax.servlet.ServletContext
      • getAttributeNames

        public Enumeration<String> getAttributeNames()
        Specified by:
        getAttributeNames in interface javax.servlet.ServletContext
      • setAttribute

        public void setAttribute​(String s,
                                 Object o)
        Specified by:
        setAttribute in interface javax.servlet.ServletContext
      • removeAttribute

        public void removeAttribute​(String s)
        Specified by:
        removeAttribute in interface javax.servlet.ServletContext
      • getServletContextName

        public String getServletContextName()
        Specified by:
        getServletContextName in interface javax.servlet.ServletContext
      • addServlet

        public javax.servlet.ServletRegistration.Dynamic addServlet​(String s,
                                                                    String s1)
        Specified by:
        addServlet in interface javax.servlet.ServletContext
      • addServlet

        public javax.servlet.ServletRegistration.Dynamic addServlet​(String s,
                                                                    javax.servlet.Servlet servlet)
        Specified by:
        addServlet in interface javax.servlet.ServletContext
      • addServlet

        public javax.servlet.ServletRegistration.Dynamic addServlet​(String s,
                                                                    Class<? extends javax.servlet.Servlet> aClass)
        Specified by:
        addServlet in interface javax.servlet.ServletContext
      • createServlet

        public <T extends javax.servlet.Servlet> T createServlet​(Class<T> aClass)
                                                          throws javax.servlet.ServletException
        Specified by:
        createServlet in interface javax.servlet.ServletContext
        Throws:
        javax.servlet.ServletException
      • getServletRegistration

        public javax.servlet.ServletRegistration getServletRegistration​(String s)
        Specified by:
        getServletRegistration in interface javax.servlet.ServletContext
      • getServletRegistrations

        public Map<String,​? extends javax.servlet.ServletRegistration> getServletRegistrations()
        Specified by:
        getServletRegistrations in interface javax.servlet.ServletContext
      • addFilter

        public javax.servlet.FilterRegistration.Dynamic addFilter​(String s,
                                                                  String s1)
        Specified by:
        addFilter in interface javax.servlet.ServletContext
      • addFilter

        public javax.servlet.FilterRegistration.Dynamic addFilter​(String s,
                                                                  javax.servlet.Filter filter)
        Specified by:
        addFilter in interface javax.servlet.ServletContext
      • addFilter

        public javax.servlet.FilterRegistration.Dynamic addFilter​(String s,
                                                                  Class<? extends javax.servlet.Filter> aClass)
        Specified by:
        addFilter in interface javax.servlet.ServletContext
      • createFilter

        public <T extends javax.servlet.Filter> T createFilter​(Class<T> aClass)
                                                        throws javax.servlet.ServletException
        Specified by:
        createFilter in interface javax.servlet.ServletContext
        Throws:
        javax.servlet.ServletException
      • getFilterRegistration

        public javax.servlet.FilterRegistration getFilterRegistration​(String s)
        Specified by:
        getFilterRegistration in interface javax.servlet.ServletContext
      • getFilterRegistrations

        public Map<String,​? extends javax.servlet.FilterRegistration> getFilterRegistrations()
        Specified by:
        getFilterRegistrations in interface javax.servlet.ServletContext
      • getSessionCookieConfig

        public javax.servlet.SessionCookieConfig getSessionCookieConfig()
        Specified by:
        getSessionCookieConfig in interface javax.servlet.ServletContext
      • setSessionTrackingModes

        public void setSessionTrackingModes​(Set<javax.servlet.SessionTrackingMode> set)
        Specified by:
        setSessionTrackingModes in interface javax.servlet.ServletContext
      • getDefaultSessionTrackingModes

        public Set<javax.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
        Specified by:
        getDefaultSessionTrackingModes in interface javax.servlet.ServletContext
      • getEffectiveSessionTrackingModes

        public Set<javax.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
        Specified by:
        getEffectiveSessionTrackingModes in interface javax.servlet.ServletContext
      • addListener

        public void addListener​(String s)
        Specified by:
        addListener in interface javax.servlet.ServletContext
      • addListener

        public <T extends EventListener> void addListener​(T t)
        Specified by:
        addListener in interface javax.servlet.ServletContext
      • addListener

        public void addListener​(Class<? extends EventListener> aClass)
        Specified by:
        addListener in interface javax.servlet.ServletContext
      • createListener

        public <T extends EventListener> T createListener​(Class<T> aClass)
                                                   throws javax.servlet.ServletException
        Specified by:
        createListener in interface javax.servlet.ServletContext
        Throws:
        javax.servlet.ServletException
      • getJspConfigDescriptor

        public javax.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()
        Specified by:
        getJspConfigDescriptor in interface javax.servlet.ServletContext
      • getClassLoader

        public ClassLoader getClassLoader()
        Specified by:
        getClassLoader in interface javax.servlet.ServletContext
      • declareRoles

        public void declareRoles​(String... strings)
        Specified by:
        declareRoles in interface javax.servlet.ServletContext
      • getVirtualServerName

        public String getVirtualServerName()
        Specified by:
        getVirtualServerName in interface javax.servlet.ServletContext