Package com.xpn.xwiki.pdf.impl
Class FileSystemURLFactory
- java.lang.Object
-
- com.xpn.xwiki.web.XWikiDefaultURLFactory
-
- com.xpn.xwiki.web.XWikiServletURLFactory
-
- com.xpn.xwiki.pdf.impl.FileSystemURLFactory
-
- All Implemented Interfaces:
XWikiURLFactory
- Direct Known Subclasses:
PdfURLFactory
public class FileSystemURLFactory extends XWikiServletURLFactory
Special URL Factory used during exports, which stores referenced attachments and resources on the filesystem, in a temporary folder, so that they can be included in the export result. The returned URLs point to these resources asfile://
links, and not ashttp://
links.- Since:
- 5.0RC1
- Version:
- $Id: 97f062a7524a4937701584ea40d0a59022ee0220 $
-
-
Field Summary
-
Fields inherited from class com.xpn.xwiki.web.XWikiServletURLFactory
contextPath, daemon, defaultURL, defaultURLs, originalURL
-
-
Constructor Summary
Constructors Constructor Description FileSystemURLFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URL
createAttachmentRevisionURL(String filename, String spaces, String name, String revision, String wiki, XWikiContext context)
URL
createAttachmentURL(String filename, String spaces, String name, String action, String querystring, String wiki, XWikiContext context)
URL
createResourceURL(String filename, boolean forceSkinAction, XWikiContext context)
Create an URL for the file resource.URL
createSkinURL(String filename, String skin, XWikiContext context)
Create a skin URL for the given filename and skin directory.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.-
Methods inherited from class com.xpn.xwiki.web.XWikiServletURLFactory
addFileName, addFileName, createAttachmentRevisionURL, createAttachmentRevisionURL, createExternalURL, createResourceURL, createSkinURL, createSkinURL, createTemplateURL, createURL, createURL, findAttachmentForDocRevision, findDeletedAttachmentForDocRevision, getContextPath, getDefaultURL, getRequestURL, getServerURL, getServerURL, init, isContextDoc, normalizeURL, normalizeURL, setDefaultURL
-
Methods inherited from class com.xpn.xwiki.web.XWikiDefaultURLFactory
createAttachmentRevisionURL, createAttachmentURL, createExternalURL, createSkinURL, createSkinURL, createSkinURL, createURL, createURL, createURL
-
-
-
-
Method Detail
-
createAttachmentURL
public URL createAttachmentURL(String filename, String spaces, String name, String action, String querystring, String wiki, XWikiContext context)
- Specified by:
createAttachmentURL
in interfaceXWikiURLFactory
- Overrides:
createAttachmentURL
in classXWikiServletURLFactory
spaces
- a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"querystring
- the URL-encoded Query String. It's important to realize that the implementation of this method cannot encode it automatically since the Query String is passed as a String (and it's not possible to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally we would need an API signature that accepts aMap<String, String>
for the Query String, for example
-
createAttachmentRevisionURL
public URL createAttachmentRevisionURL(String filename, String spaces, String name, String revision, String wiki, XWikiContext context)
- Specified by:
createAttachmentRevisionURL
in interfaceXWikiURLFactory
- Overrides:
createAttachmentRevisionURL
in classXWikiDefaultURLFactory
spaces
- a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"wiki
- the URL-encoded Query String. It's important to realize that the implementation of this method cannot encode it automatically since the Query String is passed as a String (and it's not possible to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally we would need an API signature that accepts aMap<String, String>
for the Query String, for example
-
createSkinURL
public URL createSkinURL(String filename, String skin, XWikiContext context)
Description copied from interface:XWikiURLFactory
Create a skin URL for the given filename and skin directory.- Specified by:
createSkinURL
in interfaceXWikiURLFactory
- Overrides:
createSkinURL
in classXWikiDefaultURLFactory
- Parameters:
filename
- the file to reach.skin
- the skin where the file should be loadedcontext
- current context- Returns:
- a URL to load the given file.
-
createResourceURL
public URL createResourceURL(String filename, boolean forceSkinAction, XWikiContext context)
Description copied from interface:XWikiURLFactory
Create an URL for the file resource.- Specified by:
createResourceURL
in interfaceXWikiURLFactory
- Overrides:
createResourceURL
in classXWikiDefaultURLFactory
- Parameters:
filename
- the path of the file to load.forceSkinAction
- if true specify the skin directory in the URL.context
- the current context.- Returns:
- an URL to load the given file
-
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: 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
- Specified by:
getURL
in interfaceXWikiURLFactory
- Overrides:
getURL
in classXWikiServletURLFactory
- Parameters:
url
- the URL to convert- Returns:
- the converted URL as a string
- See Also:
XWikiDefaultURLFactory.getURL(java.net.URL, com.xpn.xwiki.XWikiContext)
-
-