Package org.pentaho.platform.web.servlet
Class PluginDispatchServlet
- java.lang.Object
-
- org.pentaho.platform.web.servlet.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 Summary
Constructors Constructor Description PluginDispatchServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configurePluginWebsockets(Map.Entry<String,org.springframework.beans.factory.ListableBeanFactory> pluginBeanFactoryEntry)
Configures a platform plugin websocket endpoints.void
destroy()
String
getDispatchKey(javax.servlet.http.HttpServletRequest request)
Returns the dispatch key for this request.protected Map<String,org.springframework.beans.factory.ListableBeanFactory>
getPluginBeanFactories()
protected String
getServerUrl(String contextPath)
Gets the server URL up until the application context path.protected javax.websocket.server.ServerEndpointConfig.Configurator
getServerWebsocketEndpointConfigurator(String servletContextPath, Predicate<String> isOriginAllowedPredicate)
Get the Server Endpoint Config configurator used for registering websocket endpoints.javax.servlet.ServletConfig
getServletConfig()
String
getServletInfo()
protected javax.servlet.Servlet
getTargetServlet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected Map<String,org.pentaho.platform.api.websocket.IWebsocketEndpointConfig>
getWebsocketEndpointConfigBeans(org.springframework.beans.factory.ListableBeanFactory pluginBeanFactory)
Gets the beans that implement theIWebsocketEndpointConfig
interface from the factory received as parameter.void
init(javax.servlet.ServletConfig config)
void
service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
-
-
-
Method Detail
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Servlet
-
service
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, IOException
- Specified by:
service
in interfacejavax.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 interfacejavax.servlet.Servlet
- Throws:
javax.servlet.ServletException
-
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
- Specified by:
getServletConfig
in interfacejavax.servlet.Servlet
-
getServletInfo
public String getServletInfo()
- Specified by:
getServletInfo
in interfacejavax.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 theIWebsocketEndpointConfig
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.
-
-