Class LinkExtensionPlugin

  • All Implemented Interfaces:
    com.xpn.xwiki.internal.cache.rendering.RenderingCacheAware, XWikiPluginInterface

    public class LinkExtensionPlugin
    extends AbstractSkinExtensionPlugin
    Skin eXtension that allows inserting generic links in the <head> section of the resulting XHTML. Unlike JavaScript or StyleSheet extensions, Link extensions don't pull XDocuments as scripting or styling resources for the current document, but register additional related resources. Examples include:
    • RSS/Atom feeds
    • navigation links in a paged collection of pages (prev, next, index, glossary...)
    • semantic/metadata links (DCMI, DOAP, FOAF, RDF, OWL...)
    • generic links to other related resources or alternate views for the current document
    Since:
    1.5
    Version:
    $Id: 99447a0a3e0722139f3ab168b4db7c49105562be $
    • Constructor Detail

    • Method Detail

      • getLink

        public String getLink​(String link,
                              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 class AbstractSkinExtensionPlugin
        Parameters:
        link - 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.
      • 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 value always to declare that an extension should always be used.

        There is no support for always used link extensions yet.

        Specified by:
        getAlwaysUsedExtensions in class AbstractSkinExtensionPlugin
        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)