org.opencms.staticexport
Class CmsLinkProcessor

java.lang.Object
  extended by org.opencms.staticexport.CmsLinkProcessor

public class CmsLinkProcessor
extends Object

Handles the link replacement required e.g. to process elements for XML pages.

Since:
6.0.0
Version:
$Revision: 1.45 $
Author:
Carsten Weinholz, Alexander Kandzior

Field Summary
static String HTML_END
          HTML end.
static String HTML_START
          HTML start.
 
Constructor Summary
CmsLinkProcessor(CmsObject cms, CmsLinkTable linkTable, String encoding, String relativePath)
          Creates a new CmsLinkProcessor.
 
Method Summary
static String escapeLink(String source)
          Escapes all &, e.g.
 CmsLinkTable getLinkTable()
          Returns the link table this lik processor was initialized with.
protected  void processImageTag(ImageTag imageTag)
          Process an image tag.
 String processLinks(String content)
          Starts link processing for the given content in processing mode.
protected  void processLinkTag(LinkTag linkTag)
          Process a link tag.
 String replaceLinks(String content)
          Starts link processing for the given content in replacement mode.
static String unescapeLink(String source)
          Unescapes all &, that is replaces them with a &.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML_END

public static final String HTML_END
HTML end.

See Also:
Constant Field Values

HTML_START

public static final String HTML_START
HTML start.

See Also:
Constant Field Values
Constructor Detail

CmsLinkProcessor

public CmsLinkProcessor(CmsObject cms,
                        CmsLinkTable linkTable,
                        String encoding,
                        String relativePath)
Creates a new CmsLinkProcessor.

Parameters:
cms - the cms object
linkTable - the link table to use
encoding - the encoding to use
relativePath - additional path for links with relative path (only used in "replace" mode)
Method Detail

getLinkTable

public CmsLinkTable getLinkTable()
Returns the link table this lik processor was initialized with.

Returns:
the link table this lik processor was initialized with

processLinks

public String processLinks(String content)
                    throws ParserException
Starts link processing for the given content in processing mode.

Macros are replaced by links.

Parameters:
content - the content to process
Returns:
the processed content with replaced macros
Throws:
ParserException - if something goes wrong

replaceLinks

public String replaceLinks(String content)
                    throws ParserException
Starts link processing for the given content in replacement mode.

Links are replaced by macros.

Parameters:
content - the content to process
Returns:
the processed content with replaced links
Throws:
ParserException - if something goes wrong

processImageTag

protected void processImageTag(ImageTag imageTag)
Process an image tag.

Parameters:
imageTag - the tag to process

unescapeLink

public static String unescapeLink(String source)
Unescapes all &, that is replaces them with a &.

Parameters:
source - the String to unescape
Returns:
the unescaped String

escapeLink

public static String escapeLink(String source)
Escapes all &, e.g. replaces them with a &.

Parameters:
source - the String to escape
Returns:
the escaped String

processLinkTag

protected void processLinkTag(LinkTag linkTag)
Process a link tag.

Parameters:
linkTag - the tag to process