Class ExternalServletURLFactory

  • All Implemented Interfaces:

    public class ExternalServletURLFactory
    extends XWikiServletURLFactory
    URL Factory which always prints the absolute (external) form of URLs.
    2.6 RC2
    $Id: 8c62d8e37fa0dd5eedb043aa629175d7a6323c2a $
    • Constructor Detail

      • ExternalServletURLFactory

        public ExternalServletURLFactory​(XWikiContext context)
        Old-school constructor using the XWikiContext to initialize the factory.
        context - the current request context
    • Method Detail

      • getURL

        public String getURL​(URL url,
                             XWikiContext context)
        Description copied from class: XWikiServletURLFactory
        Converts a URL to a relative URL if it's a XWiki URL (keeping only the path + query string + anchor) and leave the URL unchanged if it's an external URL.

        An URL is considered to be external if its server component doesn't match the server of the current request URL. This means that URLs are made relative with respect to the current request URL rather than the current wiki set on the XWiki context. Let's take an example:

         request URL:
         current wiki: code (
         URL (1):
         URL (2):
         The result will be:
         (2) /xwiki/bin/view/Spage/Page
        Specified by:
        getURL in interface XWikiURLFactory
        getURL in class XWikiServletURLFactory
        url - the URL to convert
        the converted URL as a string
        See Also:
        XWikiDefaultURLFactory.getURL(, com.xpn.xwiki.XWikiContext)