com.opencms.util
Class LinkSubstitution

java.lang.Object
  |
  +--com.opencms.util.LinkSubstitution

public class LinkSubstitution
extends Object

Version:
1.0
Author:
Hanjo Riege

Constructor Summary
LinkSubstitution()
           
 
Method Summary
static String getLinkSubstitution(CmsObject cms, String link)
          Replaces the link according to the rules and registers it to the requestcontex if we are in export modus.
static String getRelativePath(String baseFile, String linkTarget)
          This methood calculates the relative path to a resource in OpenCms depending on the page where it is used.
 String substituteContentBody(String body, String webappUrl, String fileName)
           
 String substituteEditorContent(CmsObject cms, String content)
          Parses the html content for the editor.
 String substituteEditorContent(CmsObject cms, String content, String path, String relativeRoot)
          parses the html content from the editor.
 String substituteEditorContentBody(CmsObject cms, String body)
          Parses the content of the body tag of a html page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkSubstitution

public LinkSubstitution()
Method Detail

substituteEditorContentBody

public String substituteEditorContentBody(CmsObject cms,
                                          String body)
                                   throws CmsException
Parses the content of the body tag of a html page. It is the same as substituteEditorContent except that it expects only the part of the html page between the body tags.

CmsException

substituteEditorContent

public String substituteEditorContent(CmsObject cms,
                                      String content)
                               throws CmsException
Parses the html content for the editor. It replaces the links in This method is used for database imports of OpenCms versions < 5.0

Parameters:
cms - the CmsObject
content - the html content fragment
Returns:
String the converted content
CmsException

substituteContentBody

public String substituteContentBody(String body,
                                    String webappUrl,
                                    String fileName)
                             throws CmsException
CmsException

substituteEditorContent

public String substituteEditorContent(CmsObject cms,
                                      String content,
                                      String path,
                                      String relativeRoot)
                               throws CmsException
parses the html content from the editor. It replaces the links in path in opencms
CmsException

getLinkSubstitution

public static String getLinkSubstitution(CmsObject cms,
                                         String link)
Replaces the link according to the rules and registers it to the requestcontex if we are in export modus.

Returns:
String The substituded link.

getRelativePath

public static String getRelativePath(String baseFile,
                                     String linkTarget)
This methood calculates the relative path to a resource in OpenCms depending on the page where it is used. i.e.: baseFile = "/folder1/folder2/index.html" linkTarget= "/folder1/pics/pic.gif" returns: "../pics/pic.gif"

Returns:
the relative path to the target resource.