Class PluginDispatchServlet

  • All Implemented Interfaces:
    javax.servlet.Servlet

    public class PluginDispatchServlet
    extends Object
    implements javax.servlet.Servlet
    Dispatches requests to Servlets provided by BIServer plugins. To define a Servlet in a plugin, simply add a bean element for the Servlet class in the plugin.spring.xml file in your plugin root directory.
    Author:
    Aaron Phillips
    • Constructor Detail

      • PluginDispatchServlet

        public PluginDispatchServlet()
    • Method Detail

      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Servlet
      • service

        public void service​(javax.servlet.ServletRequest req,
                            javax.servlet.ServletResponse res)
                     throws javax.servlet.ServletException,
                            IOException
        Specified by:
        service in interface javax.servlet.Servlet
        Throws:
        javax.servlet.ServletException
        IOException
      • getTargetServlet

        protected javax.servlet.Servlet getTargetServlet​(javax.servlet.http.HttpServletRequest request,
                                                         javax.servlet.http.HttpServletResponse response)
                                                  throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • getDispatchKey

        public String getDispatchKey​(javax.servlet.http.HttpServletRequest request)
        Returns the dispatch key for this request. This name is the part of the request path beyond the servlet base path. I.e. if the PluginDispatchServlet is mapped to the "/plugin" context in web.xml, then this method will return "myPlugin/myServlet" given a request to "http://localhost:8080/pentaho/plugin/myPlugin/myServlet".
        Returns:
        the part of the request url used to dispatch the request
      • init

        public void init​(javax.servlet.ServletConfig config)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Servlet
        Throws:
        javax.servlet.ServletException
      • getServletConfig

        public javax.servlet.ServletConfig getServletConfig()
        Specified by:
        getServletConfig in interface javax.servlet.Servlet
      • getServletInfo

        public String getServletInfo()
        Specified by:
        getServletInfo in interface javax.servlet.Servlet
      • getPluginBeanFactories

        protected Map<String,​org.springframework.beans.factory.ListableBeanFactory> getPluginBeanFactories()
      • configurePluginWebsockets

        protected void configurePluginWebsockets​(Map.Entry<String,​org.springframework.beans.factory.ListableBeanFactory> pluginBeanFactoryEntry)
        Configures a platform plugin websocket endpoints.
        Parameters:
        pluginBeanFactoryEntry - the plugin bean factory entry
      • getServerWebsocketEndpointConfigurator

        protected javax.websocket.server.ServerEndpointConfig.Configurator getServerWebsocketEndpointConfigurator​(String servletContextPath,
                                                                                                                  Predicate<String> isOriginAllowedPredicate)
        Get the Server Endpoint Config configurator used for registering websocket endpoints.
        Parameters:
        servletContextPath - The servlet context path.
        isOriginAllowedPredicate - A predicate that validates if a origin is allowed on new connections. Can be null, and in that scenario it will be ignored.
        Returns:
        The configurator instance.
      • getWebsocketEndpointConfigBeans

        protected Map<String,​org.pentaho.platform.api.websocket.IWebsocketEndpointConfig> getWebsocketEndpointConfigBeans​(org.springframework.beans.factory.ListableBeanFactory pluginBeanFactory)
        Gets the beans that implement the IWebsocketEndpointConfig interface from the factory received as parameter.
        Parameters:
        pluginBeanFactory - The factory where the beans will be looked on.
        Returns:
        A map with the beans found.
      • getServerUrl

        protected String getServerUrl​(String contextPath)
        Gets the server URL up until the application context path.
        Parameters:
        contextPath - the application context path, used to know where to split the server URL
        Returns:
        The server URL like http://localhost:8080/