站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.4 API 英文版文档

RewriteHelper - JBOSS Portal 2.4 API 英文版文档


org.jboss.portal.core.util
Class RewriteHelper

java.lang.Object
  extended byorg.jboss.portal.core.util.RewriteHelper

public final class RewriteHelper
extends java.lang.Object

Rewrite helper class.

This class features a set of methods to rewrite markup content with unique identifiers. It can be used for WSRP consumer rewrite. The default implementation of all methods replaces the 'wsrp_rewrite_' token with the provided prefix token.


Field Summary
static java.lang.String HEADER_CONTENT
          Constant to set the content that should be injected into the HEAD tag of the pages markup.
static java.lang.String NAMESPACE_PREFIX
          Constant to set a prefix value to use during the rewrite.
static java.lang.String REWRITE_FLAG
          Constant to signal in a portlet that rewrite is requested.
 
Constructor Summary
RewriteHelper()
           
 
Method Summary
static java.lang.String rewriteContent(java.util.regex.Pattern pattern, java.lang.String content, java.lang.String prefix)
          Rewrite the content.
static java.lang.String wsrpRewriteContent(java.lang.String content, java.lang.String prefix)
          Rewrite the content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REWRITE_FLAG

public static final java.lang.String REWRITE_FLAG
Constant to signal in a portlet that rewrite is requested.

A portlet can set this flag as a response property (set to "true") to signal to the theme layer that the content needs to be rewritten. If the flag is set the theme layer will detect it and replace all 'wsrp_rewite_' tokens with the provided prefix

See Also:
Constant Field Values

NAMESPACE_PREFIX

public static final java.lang.String NAMESPACE_PREFIX
Constant to set a prefix value to use during the rewrite.

This prefix is equivalent to the producer write paradigm defined in WSRP. The portlet can set any arbitrary value to use for the rewrite, by providing this token as a response property. It is up to the portlet to decide where to get the value from.

See Also:
Constant Field Values

HEADER_CONTENT

public static final java.lang.String HEADER_CONTENT
Constant to set the content that should be injected into the HEAD tag of the pages markup.

The content set in a portlet response property with this flag will be injected into the HEAD tag, if the portal layout features the headercontent tag.

See Also:
Constant Field Values
Constructor Detail

RewriteHelper

public RewriteHelper()
Method Detail

wsrpRewriteContent

public static java.lang.String wsrpRewriteContent(java.lang.String content,
                                                  java.lang.String prefix)
Rewrite the content.

Rewrite the provided content by parsing for the 'wsrp_rewrite_' token and replacing it with the provided prefix.

Parameters:
content - the content to parse and potentially rewrite
prefix - the replacement string for the 'wsrp_rewrite_' token(s)
Returns:
the rewritten content

rewriteContent

public static java.lang.String rewriteContent(java.util.regex.Pattern pattern,
                                              java.lang.String content,
                                              java.lang.String prefix)
Rewrite the content.

Rewrite the provided content by parsing for the provided pattern, and replacing each occurence with the provided prefix.

Parameters:
pattern - the compiled regular expression to parse the content for
content - the content to parse and potentially rewrite
prefix - the replacement string for the 'wsrp_rewrite_' token(s)
Returns:
the rewritten content
See Also:
java.util.regex.Pattern#compile()