Class PluginDispatchServlet

java.lang.Object
org.pentaho.platform.web.servlet.PluginDispatchServlet
All Implemented Interfaces:
jakarta.servlet.Servlet

public class PluginDispatchServlet extends Object implements jakarta.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 Details

    • PluginDispatchServlet

      public PluginDispatchServlet()
  • Method Details

    • destroy

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

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

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

      public String getDispatchKey(jakarta.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".
      Parameters:
      request - the HTTP servlet request containing the extra URL path information.
      Returns:
      the part of the request url used to dispatch the request without leading or trailing forward slashes, or null if the URL does not have any extra path information.
    • init

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

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

      public String getServletInfo()
      Specified by:
      getServletInfo in interface jakarta.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 jakarta.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/