Package org.pentaho.platform.web.servlet
Class PluginDispatchServlet
java.lang.Object
org.pentaho.platform.web.servlet.PluginDispatchServlet
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigurePluginWebsockets(Map.Entry<String, org.springframework.beans.factory.ListableBeanFactory> pluginBeanFactoryEntry) Configures a platform plugin websocket endpoints.voiddestroy()getDispatchKey(jakarta.servlet.http.HttpServletRequest request) Returns the dispatch key for this request.protected StringgetServerUrl(String contextPath) Gets the server URL up until the application context path.protected jakarta.websocket.server.ServerEndpointConfig.ConfiguratorgetServerWebsocketEndpointConfigurator(String servletContextPath, Predicate<String> isOriginAllowedPredicate) Get the Server Endpoint Config configurator used for registering websocket endpoints.jakarta.servlet.ServletConfigprotected jakarta.servlet.ServletgetTargetServlet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) getWebsocketEndpointConfigBeans(org.springframework.beans.factory.ListableBeanFactory pluginBeanFactory) Gets the beans that implement theIWebsocketEndpointConfiginterface from the factory received as parameter.voidinit(jakarta.servlet.ServletConfig config) voidservice(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res)
-
Constructor Details
-
PluginDispatchServlet
public PluginDispatchServlet()
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet
-
service
public void service(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res) throws jakarta.servlet.ServletException, IOException - Specified by:
servicein interfacejakarta.servlet.Servlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
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
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
nullif the URL does not have any extra path information.
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Servlet- Throws:
jakarta.servlet.ServletException
-
getServletConfig
public jakarta.servlet.ServletConfig getServletConfig()- Specified by:
getServletConfigin interfacejakarta.servlet.Servlet
-
getServletInfo
- Specified by:
getServletInfoin interfacejakarta.servlet.Servlet
-
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 theIWebsocketEndpointConfiginterface 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
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/
-