Package com.xpn.xwiki.plugin.skinx
Class JsSkinFileExtensionPlugin
- java.lang.Object
-
- com.xpn.xwiki.plugin.XWikiDefaultPlugin
-
- com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
-
- com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin
-
- All Implemented Interfaces:
com.xpn.xwiki.internal.cache.rendering.RenderingCacheAware
,XWikiPluginInterface
public class JsSkinFileExtensionPlugin extends AbstractSkinExtensionPlugin
Javascript Skin File Extension plugin to use js files from the skin.- Since:
- 1.6
- Version:
- $Id: cd904d74db632d8ec176146f92281d6981b4c655 $
-
-
Field Summary
Fields Modifier and Type Field Description static String
PLUGIN_NAME
The identifier for this plugin; used for accessing the plugin from velocity, and as the action returning the extension content.-
Fields inherited from class com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
contextKey, DEFER_DEFAULT_PARAM, parametersContextKey, QUERY_PARAMETER_DELIMITER
-
-
Constructor Summary
Constructors Constructor Description JsSkinFileExtensionPlugin(String name, String className, XWikiContext context)
XWiki plugin constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
endParsing(String content, XWikiContext context)
Set<String>
getAlwaysUsedExtensions(XWikiContext context)
Returns the list of always used extensions of this type.String
getLink(String filename, XWikiContext context)
Abstract method for obtaining a link that points to the actual pulled resource.String
getName()
Api
getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
boolean
hasPageExtensions(XWikiContext context)
Determines if the requested document contains on page skin extension objects of this type.-
Methods inherited from class com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
getCacheResources, getCurrentDocumentReferenceResolver, getDefaultEntityReferenceSerializer, getImportString, getLink, getParameter, getParametersForResource, getParametersMap, getPulledResources, getSkinExtensionAsync, initializeRequestListIfNeeded, parametersAsQueryString, restoreCacheResources, sanitize, use, use
-
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginParsing, beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, getLocalization, init, insidePREHandler, localizePlainOrKey, outsidePREHandler, setClassName, setName, startRenderingHandler, virtualInit
-
-
-
-
Field Detail
-
PLUGIN_NAME
public static final String PLUGIN_NAME
The identifier for this plugin; used for accessing the plugin from velocity, and as the action returning the extension content.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JsSkinFileExtensionPlugin
public JsSkinFileExtensionPlugin(String name, String className, XWikiContext context)
XWiki plugin constructor.- Parameters:
name
- The name of the plugin, which can be used for retrieving the plugin API from velocity. Unused.className
- The canonical classname of the plugin. Unused.context
- The current request context.- See Also:
XWikiDefaultPlugin(String,String,com.xpn.xwiki.XWikiContext)
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in interfaceXWikiPluginInterface
- Overrides:
getName
in classXWikiDefaultPlugin
-
getPluginApi
public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
- Specified by:
getPluginApi
in interfaceXWikiPluginInterface
- Overrides:
getPluginApi
in classAbstractSkinExtensionPlugin
-
getLink
public String getLink(String filename, XWikiContext context)
Description copied from class:AbstractSkinExtensionPlugin
Abstract method for obtaining a link that points to the actual pulled resource. Each type of resource has its own format for the link, for example Javascript uses<script src="/path/to/Document">
, while CSS uses<link rel="stylesheet" href="/path/to/Document">
(the actual syntax is longer, this is just a simplified example).- Specified by:
getLink
in classAbstractSkinExtensionPlugin
- Parameters:
filename
- the name of the wiki document holding the resource.context
- the current request context, needed to access the URLFactory.- Returns:
- A
String
representation of the linking element that should be printed in the generated HTML.
-
endParsing
public String endParsing(String content, XWikiContext context)
At the end of the request, insert the links to the pulled resources in the response, in the place marked by an XML comment of the format
<!-- canonical.plugin.classname -->
.We must override this method since the plugin manager only calls it for classes that provide their own implementation, and not an inherited one.
- Specified by:
endParsing
in interfaceXWikiPluginInterface
- Overrides:
endParsing
in classAbstractSkinExtensionPlugin
- See Also:
AbstractSkinExtensionPlugin.endParsing(String, XWikiContext)
-
getAlwaysUsedExtensions
public Set<String> getAlwaysUsedExtensions(XWikiContext context)
Returns the list of always used extensions of this type. Which resources are always used depends on the type of resource, for example document based StyleSheet extensions have a property in the object,use
, which can have the valuealways
to declare that an extension should always be used.There is no support for always used skinfile-based extensions.
- Specified by:
getAlwaysUsedExtensions
in classAbstractSkinExtensionPlugin
- Parameters:
context
- The current request context.- Returns:
- A set of resource names that should be pulled in the current response. Note that this method is called for each request, as the list might change in time, and it can be different for each wiki in a farm.
- See Also:
AbstractSkinExtensionPlugin.getAlwaysUsedExtensions(XWikiContext)
-
hasPageExtensions
public boolean hasPageExtensions(XWikiContext context)
Determines if the requested document contains on page skin extension objects of this type. True if at least one of the extension objects has thecurrentPage
value for theuse
property.Not supported for skinfile-based extensions.
- Specified by:
hasPageExtensions
in classAbstractSkinExtensionPlugin
- Parameters:
context
- the current request context- Returns:
- a boolean specifying if the current document contains on page skin extensions
- See Also:
AbstractSkinExtensionPlugin.hasPageExtensions(com.xpn.xwiki.XWikiContext)
-
-