org.opencms.jsp.util
Class CmsJspLinkMacroResolver

java.lang.Object
  extended by org.opencms.jsp.util.CmsJspLinkMacroResolver
All Implemented Interfaces:
I_CmsMacroResolver

public class CmsJspLinkMacroResolver
extends java.lang.Object
implements I_CmsMacroResolver

Resolves link macros for jsp pages.

The only supported macro is the 'link' macro.

Since:
6.5.4
Version:
$Revision: 1.8 $
Author:
Michael Moossen

Field Summary
static char KEY_SEPARATOR
          Identifier for the link macro separator.
static java.lang.String MACRO_LINK
          Identifier for the link macro name.
static java.lang.String MACRO_LINK_STRONG
          Identifier for the link macro name.
static java.lang.String MACRO_LINK_WEAK
          Identifier for the link macro name.
static java.lang.String[] VALUE_NAME_ARRAY
          Identifier for link commands.
static java.util.List VALUE_NAMES
          The link commands wrapped in a List.
 
Fields inherited from interface org.opencms.util.I_CmsMacroResolver
MACRO_DELIMITER, MACRO_DELIMITER_OLD, MACRO_END, MACRO_END_OLD, MACRO_START, MACRO_START_OLD
 
Constructor Summary
CmsJspLinkMacroResolver(CmsObject cms, java.lang.String jspRootPath, boolean forRfs)
          Default constructor.
 
Method Summary
 java.util.List getLinks()
          Returns the links.
 java.lang.String getMacroValue(java.lang.String macro)
          Resolves a single macro to the macro value, returns null if the macro could not be resolved.
 boolean isKeepEmptyMacros()
          Returns true if macros that could not be resolved are kept "as is" in the input String, false if they are replaced by an empty String.
 java.lang.String resolveMacros(java.lang.String input)
          Resolves the JSP link management macros in the given input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_SEPARATOR

public static final char KEY_SEPARATOR
Identifier for the link macro separator.

See Also:
Constant Field Values

MACRO_LINK

public static final java.lang.String MACRO_LINK
Identifier for the link macro name.

See Also:
Constant Field Values

MACRO_LINK_STRONG

public static final java.lang.String MACRO_LINK_STRONG
Identifier for the link macro name.

See Also:
Constant Field Values

MACRO_LINK_WEAK

public static final java.lang.String MACRO_LINK_WEAK
Identifier for the link macro name.

See Also:
Constant Field Values

VALUE_NAME_ARRAY

public static final java.lang.String[] VALUE_NAME_ARRAY
Identifier for link commands.


VALUE_NAMES

public static final java.util.List VALUE_NAMES
The link commands wrapped in a List.

Constructor Detail

CmsJspLinkMacroResolver

public CmsJspLinkMacroResolver(CmsObject cms,
                               java.lang.String jspRootPath,
                               boolean forRfs)
Default constructor.

Parameters:
cms - the cms context
jspRootPath - the (optional) jsp root path, needed for saving from the editor to resolve relative links
forRfs - Only if true the macros get really resolved to valid vfs paths
Method Detail

getLinks

public java.util.List getLinks()
Returns the links.

Returns:
the links

getMacroValue

public java.lang.String getMacroValue(java.lang.String macro)
Description copied from interface: I_CmsMacroResolver
Resolves a single macro to the macro value, returns null if the macro could not be resolved.

Specified by:
getMacroValue in interface I_CmsMacroResolver
Parameters:
macro - the macro to resolve
Returns:
the resolved macro or null if the macro could not be resolved
See Also:
I_CmsMacroResolver.getMacroValue(java.lang.String)

isKeepEmptyMacros

public boolean isKeepEmptyMacros()
Description copied from interface: I_CmsMacroResolver
Returns true if macros that could not be resolved are kept "as is" in the input String, false if they are replaced by an empty String.

Specified by:
isKeepEmptyMacros in interface I_CmsMacroResolver
Returns:
true if macros that could not be resolved are kept "as is" in the input String, false if they are replaced by an empty String
See Also:
I_CmsMacroResolver.isKeepEmptyMacros()

resolveMacros

public java.lang.String resolveMacros(java.lang.String input)
Resolves the JSP link management macros in the given input.

Calls resolveMacros(String) once for each macro in the input. This means "nested" macros are not supported in this implementation, which is fine since it can't happen in JSP link management anyway.

Specified by:
resolveMacros in interface I_CmsMacroResolver
Parameters:
input - the input to resolve the macros in
Returns:
the input with all macros resolved
See Also:
I_CmsMacroResolver.resolveMacros(java.lang.String)