com.xpn.xwiki.pdf.impl
Class FileSystemURLFactory

java.lang.Object
  extended by com.xpn.xwiki.web.XWikiDefaultURLFactory
      extended by com.xpn.xwiki.web.XWikiServletURLFactory
          extended by 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 as file:// links, and not as http:// links.

Since:
5.0RC1
Version:
$Id: cd7a677f15c8ec0c24604d8f0911c43468913f5a $

Field Summary
 
Fields inherited from class com.xpn.xwiki.web.XWikiServletURLFactory
contextPath, serverURL
 
Constructor Summary
FileSystemURLFactory()
           
 
Method Summary
 URL createAttachmentRevisionURL(String filename, String space, String name, String revision, String wiki, XWikiContext context)
           
 URL createAttachmentURL(String filename, String space, String name, String action, String querystring, String wiki, XWikiContext context)
           
 URL createResourceURL(String filename, boolean forceSkinAction, XWikiContext context)
           
 URL createSkinURL(String filename, String skin, XWikiContext context)
           
 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, createSkinURL, createTemplateURL, createURL, createURL, findAttachmentForDocRevision, findDeletedAttachmentForDocRevision, getContextPath, getRequestURL, getServerURL, getServerURL, init, isContextDoc, normalizeURL, normalizeURL
 
Methods inherited from class com.xpn.xwiki.web.XWikiDefaultURLFactory
createAttachmentRevisionURL, createAttachmentURL, createExternalURL, createSkinURL, createURL, createURL, createURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemURLFactory

public FileSystemURLFactory()
Method Detail

createAttachmentURL

public URL createAttachmentURL(String filename,
                               String space,
                               String name,
                               String action,
                               String querystring,
                               String wiki,
                               XWikiContext context)
Specified by:
createAttachmentURL in interface XWikiURLFactory
Overrides:
createAttachmentURL in class XWikiServletURLFactory

createAttachmentRevisionURL

public URL createAttachmentRevisionURL(String filename,
                                       String space,
                                       String name,
                                       String revision,
                                       String wiki,
                                       XWikiContext context)
Specified by:
createAttachmentRevisionURL in interface XWikiURLFactory
Overrides:
createAttachmentRevisionURL in class XWikiDefaultURLFactory

createSkinURL

public URL createSkinURL(String filename,
                         String skin,
                         XWikiContext context)
Specified by:
createSkinURL in interface XWikiURLFactory
Overrides:
createSkinURL in class XWikiServletURLFactory

createResourceURL

public URL createResourceURL(String filename,
                             boolean forceSkinAction,
                             XWikiContext context)
Specified by:
createResourceURL in interface XWikiURLFactory
Overrides:
createResourceURL in class XWikiServletURLFactory

getURL

public 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.

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 interface XWikiURLFactory
Overrides:
getURL in class XWikiServletURLFactory
Parameters:
url - the URL to convert
Returns:
the converted URL as a string
See Also:
XWikiDefaultURLFactory.getURL(java.net.URL, com.xpn.xwiki.XWikiContext)


Copyright © 2004–2014 XWiki. All rights reserved.