Package de.xima.fc.servlet.resource
Interface IPluginStaticResourceServletAction
- All Superinterfaces:
- IFCPlugin,- INamedUiElement,- INameProviding,- IPluginServletAction,- ITransferable,- Serializable
- All Known Implementing Classes:
- APluginStaticResourceServletAction
Mixin for 
IPluginServletAction that provides a basic implementation for a servlet action that provides static
 resources.
 The execute should not be overridden. All other methods implement
 sane defaults, are orthogonal to each other and can be overridden as required.
- Since:
- 1.0.0
- Author:
- XIMA MEDIA GmbH
- 
Field SummaryFields inherited from interface de.xima.fc.plugin.interfaces.IFCPluginCONFIG_FILENAMEFields inherited from interface de.xima.fc.interfaces.INamedUiElementATTR_DISPLAY_NAMEFields inherited from interface de.xima.fc.entities.interfaces.INameProvidingATTR_NAME, COL_NAME
- 
Method SummaryModifier and TypeMethodDescriptiondefault IPluginServletActionRetValThe main method of this plugin.default StringfindContentType(String internalPath) Finds the content type of a requested path.default StringThe URL parameter that contains the requested resource path.getResourceTag(String internalPath) Gets the tag of the requested resource path.default booleanisPathSupported(String externalPath) Checks if the requested path is supported or allowed.default byte[]readResource(String internalPath) Reads the resource for the requested path.default IPluginServletActionRetValCreates the response for when thepath parameterswas not provided.default IPluginServletActionRetValrespondResourceFound(String fileName, String contentType, byte[] content) Creates the response for when the resource was found.default IPluginServletActionRetValCreates the response for when the resource could not be found.default IPluginServletActionRetValCreates the response for when an unexpected error occurred.default IPluginServletActionRetValCreates the response for when the requested path is not acceptable.default StringtoInternalPath(String externalPath) Converts an external path to an internal path.Methods inherited from interface de.xima.fc.plugin.interfaces.IFCPlugingetDescription, getDescription, getDisplayName, getName, initialize, initPlugin, install, shutdown, shutdown, uninstall, validateConfigurationData
- 
Method Details- 
executedefault IPluginServletActionRetVal execute(IPluginServletActionParams args) throws FCPluginException Description copied from interface:IPluginServletActionThe main method of this plugin.When any exception other than FCPluginExceptionis thrown, a generic HTML error page is returned to the client.- Specified by:
- executein interface- IPluginServletAction
- Parameters:
- args- The parameters this plugin may make use of. Contains for example the URL parameters, the data of the- HttpSessionor the current- user.
- Returns:
- The HTTP response code and the data to be sent as the response.
- Throws:
- FCPluginException- May be thrown when this plugin cannot handle the request. When this exception is thrown, a- 404HTTP response is returned to the client.
 
- 
findContentTypeFinds the content type of a requested path. Defaults to making a best guess based on the file name.- Parameters:
- internalPath- Path to check.
- Returns:
- The content type of the resource with the given path.
 
- 
getPathParamThe URL parameter that contains the requested resource path. Defaults topath.- Returns:
- The URL parameter that contains the requested resource path.
 
- 
getResourceTagGets the tag of the requested resource path. The tag is used for caching. As long as the tag does not change, the resource content is not sent again to clients that already have the resource.- Parameters:
- internalPath- Path to check.
- Returns:
- The (version) tag of the given resource path.
 
- 
isPathSupportedChecks if the requested path is supported or allowed. If not, an error response is sent back to the client immediately. Defaults to allowing common resource files such as text files, images, fonts, and JavaScript and CSS.- Parameters:
- externalPath- Path to check.
- Returns:
- trueif the requested path is supported,- falseotherwise.
 
- 
readResourceReads the resource for the requested path. Defaults to reading the resource in theclass pathof this class.- Parameters:
- internalPath- Path of the resource.
- Returns:
- The contents of the resource, or nullif not found.
 
- 
respondMissingPathCreates the response for when thepath parameterswas not provided. Defaults to sending a 404.- Returns:
- The response when a resource was not found.
 
- 
respondResourceFounddefault IPluginServletActionRetVal respondResourceFound(String fileName, String contentType, byte[] content) Creates the response for when the resource was found. Defaults to sending a 200 with the contents of the resource.- Parameters:
- fileName- Name of the requested file.
- contentType- Content type of the file.
- content- Content of the file.
- Returns:
- The response when a resource was found.
 
- 
respondResourceNotFoundCreates the response for when the resource could not be found. Defaults to sending a 404.- Returns:
- The response when a resource was not found.
 
- 
respondServerErrorCreates the response for when an unexpected error occurred. Defaults to sending a 500.- Returns:
- The response when an unexpected error occurred.
 
- 
respondUnsupportedPathCreates the response for when the requested path is not acceptable. Defaults to sending a 400.- Returns:
- The response when the requested path is not acceptable.
 
- 
toInternalPathConverts an external path to an internal path. Called after the external path was checked viaisPathSupported. The external path is the path as requested. The internal path is passed togetResourceTag,findContentType, andreadResource. The default implementation simply return the path as given. Can be used e.g. to prepend a prefix such as a directory or a package path.- Parameters:
- externalPath- External path to convert.
- Returns:
- The internal path representing the resource.
 
 
-