public class ExternalServletURLFactory extends XWikiServletURLFactory
contextPath, serverURL
Constructor and Description |
---|
ExternalServletURLFactory(XWikiContext context)
Old-school constructor using the XWikiContext to initialize the factory.
|
Modifier and Type | Method and Description |
---|---|
String |
getURL(URL url,
XWikiContext context)
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.
|
addFileName, addFileName, createAttachmentRevisionURL, createAttachmentRevisionURL, createAttachmentURL, createExternalURL, createResourceURL, createSkinURL, createSkinURL, createTemplateURL, createURL, createURL, findAttachmentForDocRevision, findDeletedAttachmentForDocRevision, getContextPath, getRequestURL, getServerURL, getServerURL, init, isContextDoc, normalizeURL, normalizeURL
createAttachmentRevisionURL, createAttachmentRevisionURL, createAttachmentURL, createExternalURL, createSkinURL, createURL, createURL, createURL
public ExternalServletURLFactory(XWikiContext context)
context
- the current request contextpublic String getURL(URL url, XWikiContext context)
XWikiServletURLFactory
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: http://playground.xwiki.org/xwiki/bin/view/Sandbox/TestURL
current wiki: code (code.xwiki.org)
URL (1): http://code.xwiki.org/xwiki/bin/view/Main/WebHome
URL (2): http://playground.xwiki.org/xwiki/bin/view/Spage/Page
The result will be:
(1) http://code.xwiki.org/xwiki/bin/view/Main/WebHome
(2) /xwiki/bin/view/Spage/Page
getURL
in interface XWikiURLFactory
getURL
in class XWikiServletURLFactory
url
- the URL to convertXWikiDefaultURLFactory.getURL(java.net.URL, com.xpn.xwiki.XWikiContext)
Copyright © 2004–2015 XWiki. All rights reserved.