Class AbstractAppPluginRootResource<T extends AppPlugin>

    • Field Detail

      • MIME_TYPE_TEXT_PLAIN

        public static final java.lang.String MIME_TYPE_TEXT_PLAIN
        See Also:
        Constant Field Values
      • MIME_TYPE_TEXT_HTML

        public static final java.lang.String MIME_TYPE_TEXT_HTML
        See Also:
        Constant Field Values
      • MIME_TYPE_TEXT_CSS

        public static final java.lang.String MIME_TYPE_TEXT_CSS
        See Also:
        Constant Field Values
      • MIME_TYPE_TEXT_JAVASCRIPT

        public static final java.lang.String MIME_TYPE_TEXT_JAVASCRIPT
        See Also:
        Constant Field Values
      • servletContext

        @Context
        protected javax.servlet.ServletContext servletContext
      • headers

        @Context
        protected javax.ws.rs.core.HttpHeaders headers
      • uriInfo

        @Context
        protected javax.ws.rs.core.UriInfo uriInfo
      • allowedAssets

        protected java.util.List<java.lang.String> allowedAssets
    • Constructor Detail

      • AbstractAppPluginRootResource

        public AbstractAppPluginRootResource​(java.lang.String pluginName,
                                             AppRuntimeDelegate<T> runtimeDelegate)
    • Method Detail

      • getAllowedAssets

        protected java.util.List<java.lang.String> getAllowedAssets()

        Returns the list of allowed assets to be served by the getAsset(String) method.

        The default implementation includes: ["app/plugin.js","app/plugin.css"]

        Returns:
        list of allowed assets
      • subResource

        protected <S extends AbstractAppPluginResource<T>> S subResource​(S subResource,
                                                                         java.lang.String engineName)
        Type Parameters:
        T -
        Parameters:
        subResource -
        engineName -
        Returns:
      • getAsset

        @GET
        @Path("/static/{file:.*}")
        public javax.ws.rs.core.Response getAsset​(@PathParam("file")
                                                  java.lang.String file)

        Provides a plugins asset files via $PLUGIN_ROOT_PATH/static.

        Assets must be explicitly declared in the getAllowedAssets() method.

        Parameters:
        file -
        Returns:
      • applyResourceOverrides

        protected java.io.InputStream applyResourceOverrides​(java.lang.String file,
                                                             java.io.InputStream assetStream)
        Parameters:
        file -
        assetStream -
      • getContentType

        protected java.lang.String getContentType​(java.lang.String file)
      • getPluginAssetAsStream

        protected java.io.InputStream getPluginAssetAsStream​(AppPlugin plugin,
                                                             java.lang.String fileName)
        Returns an input stream for a given resource
        Parameters:
        resourceName -
        Returns:
      • getWebResourceAsStream

        protected java.io.InputStream getWebResourceAsStream​(java.lang.String assetDirectory,
                                                             java.lang.String fileName)
      • getClasspathResourceAsStream

        protected java.io.InputStream getClasspathResourceAsStream​(AppPlugin plugin,
                                                                   java.lang.String assetDirectory,
                                                                   java.lang.String fileName)