Class AbstractAppPluginRootResource<T extends AppPlugin>

java.lang.Object
org.camunda.bpm.webapp.plugin.resource.AbstractAppPluginRootResource<T>
Direct Known Subclasses:
AbstractAdminPluginRootResource, AbstractCockpitPluginRootResource, AbstractTasklistPluginRootResource, AbstractWelcomePluginRootResource

public class AbstractAppPluginRootResource<T extends AppPlugin> extends Object
A resource class that provides a plugins restful API.

Subclasses of this class may provide subresources using annotated getters in order to be multi-engine aware.

Subresources must properly initialize the subresources via subResource(AbstractAppPluginResource, String).

Author:
nico.rehwaldt, Daniel Meyer
  • Field Details

    • MIME_TYPE_TEXT_PLAIN

      public static final String MIME_TYPE_TEXT_PLAIN
      See Also:
    • MIME_TYPE_TEXT_HTML

      public static final String MIME_TYPE_TEXT_HTML
      See Also:
    • MIME_TYPE_TEXT_CSS

      public static final String MIME_TYPE_TEXT_CSS
      See Also:
    • MIME_TYPE_TEXT_JAVASCRIPT

      public static final String MIME_TYPE_TEXT_JAVASCRIPT
      See Also:
    • 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
    • runtimeDelegate

      protected AppRuntimeDelegate<T extends AppPlugin> runtimeDelegate
    • allowedAssets

      protected List<String> allowedAssets
  • Constructor Details

    • AbstractAppPluginRootResource

      public AbstractAppPluginRootResource(String pluginName, AppRuntimeDelegate<T> runtimeDelegate)
  • Method Details

    • getAllowedAssets

      protected List<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, String engineName)
      Type Parameters:
      T -
      Parameters:
      subResource -
      engineName -
      Returns:
    • getAsset

      @GET @Path("/static/{file:.*}") public javax.ws.rs.core.Response getAsset(@PathParam("file") 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 InputStream applyResourceOverrides(String file, InputStream assetStream)
      Parameters:
      file -
      assetStream -
    • getContentType

      protected String getContentType(String file)
    • getPluginAssetAsStream

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

      protected InputStream getWebResourceAsStream(String assetDirectory, String fileName)
    • getClasspathResourceAsStream

      protected InputStream getClasspathResourceAsStream(AppPlugin plugin, String assetDirectory, String fileName)