|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The ITemplateProcessor Interface ITemplateProcessor defines methods to parse a template and to process its tag expressions. The Template Processing step substitutes the tag expressions by values stored in contexts where the context names must match the tag expressions.
Definitions:
java.util.Hashtable. Contexts can be nested in opposite to hashtables.Nested contexts are accessed by tag expressions, where the single varibales in the tag expression describe the "path" in the context tree. If a variable doesn't matche to a context, the tag is replaced with the empty string.
Processed tag expressions can be automatically URLEncoded by placing a percent sign just before the ending angle bracket.
Note: This approach is deprecated and the URL_ENC
modifier should be used instead.
Example: "<this.will.be.Urlencoded[URL_ENC]>"
The slash is the escape character in templates. Angle brackets prefixed by the slash aren't treated as tags and substituted by themself (stripping the slash of course): < has to be escaped by /< and > has to be escaped by />
Template grammar:
| template | ::= ( plain | tag )* |
| tag | ::= "<" tagexpr ">" | "<" tagexpr ( modif_seq | encode )">" |
| tagexpr | ::= simpletagexr ( "." simpletagexr )* |
| simpletagexpr | ::= alpha alphanum* |
| alpha | ::= "A" | ... | "Z" | "a" | ... | "z" | "_" |
| alphanum | ::= alpha | "0" | ... | "9" |
| reserved | ::= "<" | ">" |
| unreserved | ::= ... all characters except the reserved ones |
| plain | ::= unreserved* |
| modif_seq | ::= ( alphanum+ " " )+ |
| encode | ::= "%" DEPRECATED |
Example:
<Protocol>://<HostAddress>:<Port>/some/path?user=<User.Name[UPR_CASE]>&url=<HomeServer.url[URL_ENC UPR_CASE]>
| Field Summary | |
static java.lang.String |
MODIFIER_BASE64
Modifier for UTF8 + BASE64: BASE64 |
static java.lang.String |
MODIFIER_ESID
Modifier for standard External Session ID: ESID |
static java.lang.String |
MODIFIER_HASH
Modifier for Java-Hash function |
static java.lang.String |
MODIFIER_HTML_ESCAPE
Modifier for HTML escaping: HTML_ESCAPE |
static java.lang.String |
MODIFIER_IF_FALSE
Modifier for selective processing - negative (replace whole expression by empty string): IF_FALSE |
static java.lang.String |
MODIFIER_IF_TRUE
Modifier for selective processing - positive (do nothing): IF_TRUE |
static java.lang.String |
MODIFIER_LOWERCASE
Modifier for lowercase convertion: LOWERCASE |
static java.lang.String |
MODIFIER_MD5
Modifier for UTF8 + MD5 hash: MD5 |
static java.lang.String |
MODIFIER_MD5_BASE64
Modifier for combination of UTF8 + MD5 + BASE64: MD5_BASE64 |
static java.lang.String |
MODIFIER_PORTAL_URL
Modifier for Portal URL: PORTAL_URL |
static java.lang.String |
MODIFIER_PROCESS_RECURSIVE
Modifier for recursive template processing: PROCESS_RECURSIVE |
static java.lang.String |
MODIFIER_SAP_BOOL
converts boolean values to SAP notation. true/1 -> 'X', false/0 -> '': SAP_BOOL |
static java.lang.String |
MODIFIER_SAP_ITS_NAMESPACE
Modifier for SAP-ITS Namespace: SAP_ITS_NAMESPACE |
static java.lang.String |
MODIFIER_TRIM
Modifier for string trimming: TRIM |
static java.lang.String |
MODIFIER_UPPERCASE
Modifier for uppercase convertion: UPPERCASE |
static java.lang.String |
MODIFIER_URL_DECODE
Modifier for url decoding: URL_DECODE |
static java.lang.String |
MODIFIER_URL_ENCODE
Modifier for url encoding: URL_ENCODE |
static java.lang.String |
MODIFIER_URL64
Modifier for UTF8 + URL64 - special SAP version of BASE64 that uses '-' instead of '/': URL64 |
static java.lang.String |
MODIFIER_WAS_ESID
Modifier for WAS related External Session ID: WAS_ESID |
| Method Summary | |
java.lang.String |
process(java.lang.String template,
IAccessor root,
com.sapportals.portal.prt.component.IPortalComponentRequest request,
boolean errorMode)
main parsing method which takes a root context and a template to process |
java.lang.String |
process(java.lang.String template,
IAccessor root,
java.util.Locale loc)
Processes the given template using the given root context and the given locale. |
java.lang.String |
process(java.lang.String template,
IAccessor root,
java.util.Locale locale,
boolean errorMode)
main process method which takes a root context and a template to process |
| Field Detail |
public static final java.lang.String MODIFIER_URL_ENCODE
public static final java.lang.String MODIFIER_URL_DECODE
public static final java.lang.String MODIFIER_UPPERCASE
public static final java.lang.String MODIFIER_LOWERCASE
public static final java.lang.String MODIFIER_TRIM
public static final java.lang.String MODIFIER_HTML_ESCAPE
public static final java.lang.String MODIFIER_SAP_ITS_NAMESPACE
public static final java.lang.String MODIFIER_SAP_BOOL
public static final java.lang.String MODIFIER_MD5
public static final java.lang.String MODIFIER_BASE64
public static final java.lang.String MODIFIER_URL64
public static final java.lang.String MODIFIER_MD5_BASE64
public static final java.lang.String MODIFIER_PROCESS_RECURSIVE
public static final java.lang.String MODIFIER_ESID
public static final java.lang.String MODIFIER_WAS_ESID
public static final java.lang.String MODIFIER_PORTAL_URL
public static final java.lang.String MODIFIER_IF_TRUE
public static final java.lang.String MODIFIER_IF_FALSE
public static final java.lang.String MODIFIER_HASH
| Method Detail |
public java.lang.String process(java.lang.String template,
IAccessor root,
java.util.Locale loc)
throws TemplateParserException
template - the template that is to be processedroot - the root contextloc - the locale to be used when context terminals are locale dependedTemplateParserException, - if parsing fails
(due to invalid template for example)IAccessor,
ITemplateProcessor
public java.lang.String process(java.lang.String template,
IAccessor root,
java.util.Locale locale,
boolean errorMode)
throws java.lang.NullPointerException,
TemplateParserException
template - the template that is to be processedroot - the root contextlocale - the locale for language depended propertieserrorMode - if true, invalid tag expressions result in an exception,
if false, invalid tag expressions are replaced by the empty word.NullPointerException, - if either template or
root is nullTemplateParserException -
public java.lang.String process(java.lang.String template,
IAccessor root,
com.sapportals.portal.prt.component.IPortalComponentRequest request,
boolean errorMode)
throws java.lang.NullPointerException,
TemplateParserException
template - the template that is to be processedroot - the root contextrequest - Portal Component RequesterrorMode - if true, invalid tag expressions result in an exception,
if false, invalid tag expressions are replaced by the empty word.NullPointerException, - if either template or
root is nullTemplateParserException -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||