ERXResponseRewriter Class Reference

Collaboration diagram for ERXResponseRewriter:

Collaboration graph
[legend]

List of all members.

Classes

class  ContextObserver
interface  Delegate
class  Resource

Public Types

enum  TagMissingBehavior { Top, Inline, Skip, SkipAndWarn }

Static Public Member Functions

static String _htmlCloseHeadTag ()
static boolean addResourceInHead (WOResponse response, WOContext context, String framework, String fileName, String startTag, String endTag, String fallbackStartTag, String fallbackEndTag, TagMissingBehavior tagMissingBehavior)
static boolean addResourceInHead (WOResponse response, WOContext context, String framework, String fileName, String startTag, String endTag, TagMissingBehavior tagMissingBehavior)
static void addResourceInHead (WOResponse response, WOContext context, String framework, String fileName, String startTag, String endTag)
static void addScriptCodeInHead (WOResponse response, WOContext context, String script, String scriptName)
static void addScriptCodeInHead (WOResponse response, WOContext context, String script)
static void addScriptResourceInHead (WOResponse response, WOContext context, String framework, String fileName)
static void addStylesheetResourceInHead (WOResponse response, WOContext context, String framework, String fileName, String media)
static void addStylesheetResourceInHead (WOResponse response, WOContext context, String framework, String fileName)
static NSMutableDictionary
< String, Object > 
ajaxPageUserInfo (WOContext context)
static boolean insertInResponseBeforeHead (WOResponse response, WOContext context, String content, TagMissingBehavior tagMissingBehavior)
static boolean insertInResponseBeforeTag (WOResponse response, WOContext context, String content, String tag, TagMissingBehavior tagMissingBehavior)
static boolean isResourceAddedToHead (WOContext context, String frameworkName, String resourceName)
static NSMutableDictionary
< String, Object > 
pageUserInfo (WOComponent page)
static NSMutableDictionary
< String, Object > 
pageUserInfo (WOContext context)
static void replaceAllInResponse (WOResponse response, WOContext context, Pattern pattern, String replacement)
static void replaceFirstInResponse (WOResponse response, WOContext context, Pattern pattern, String replacement)
static void resourceAddedToHead (WOContext context, String frameworkName, String resourceName)
static NSMutableSet< StringresourcesAddedToHead (WOContext context)
static void setDelegate (ERXResponseRewriter.Delegate delegate)

Static Public Attributes

static final Logger log = Logger.getLogger(ERXResponseRewriter.class)

Static Package Functions

 [static initializer]

Static Private Attributes

static Map< WOComponent,
NSMutableDictionary< String,
Object > > 
_ajaxPageUserInfos
static Delegate _delagate
static Map< WOComponent,
NSMutableDictionary< String,
Object > > 
_pageUserInfos
static final String ADDED_RESOURCES_KEY = "ERXResponseRewriter.addedResources"
static final String CONTEXT_OBSERVER_KEY = "ERXResponseRewriter.contextObserver"
static final String ORIGINAL_CONTEXT_ID_KEY = "_originalContextID"
static final String PENDING_INSERTS_KEY = "ERXResponseRewriter.pendingInserts"
static final String SECURE_RESOURCES_KEY = "er.ajax.secureResources"
static final String TOP_INDEX_KEY = "ERXResponseRewriter.topIndex"


Member Enumeration Documentation

TagMissingBehavior specifies several ways the response rewriter should handle the case of having a missing tag that you attempted to insert in front of (for instance, if you ask to insert in the head tag and the head tag does not exist).

Author:
mschrag
Enumerator:
Top  Top tries to behave like head-insertion by maintaining the same ordering as head would (first added, first printed). If an Ajax response, top would push to the front of the response.
Inline  Inline just renders the content at the current location in the response.
Skip  Skip does not render the content at all and silently ignores the missing tag.
SkipAndWarn  Like skip, no content will be rendered into the response, but a warning will be printed onto the console.


Member Function Documentation

[static initializer] (  )  [static, package]

static String _htmlCloseHeadTag (  )  [static]

Returns the tag name that scripts and resources should be inserted above. Defaults to </head>, but this can be overridden by setting the property er.ajax.AJComponent.htmlCloseHead.

static boolean addResourceInHead ( WOResponse  response,
WOContext  context,
String  framework,
String  fileName,
String  startTag,
String  endTag,
String  fallbackStartTag,
String  fallbackEndTag,
TagMissingBehavior  tagMissingBehavior 
) [static]

Adds a reference to an arbitrary file with a correct resource url wrapped between startTag and endTag in the html head tag if it isn't already present in the response.

Parameters:
response 
context 
framework 
fileName 
startTag 
endTag 
fallbackStartTag 
fallbackEndTag 
tagMissingBehavior 
Returns:
whether or not the content was added

static boolean addResourceInHead ( WOResponse  response,
WOContext  context,
String  framework,
String  fileName,
String  startTag,
String  endTag,
TagMissingBehavior  tagMissingBehavior 
) [static]

Adds a reference to an arbitrary file with a correct resource url wrapped between startTag and endTag in the html head tag if it isn't already present in the response.

Parameters:
response 
fileName 
startTag 
endTag 
Returns:
whether or not the content was added

static void addResourceInHead ( WOResponse  response,
WOContext  context,
String  framework,
String  fileName,
String  startTag,
String  endTag 
) [static]

Adds a reference to an arbitrary file with a correct resource url wrapped between startTag and endTag in the html head tag if it isn't already present in the response.

Parameters:
context the context
response the response
framework the framework that contains the file
fileName the name of the file to add
startTag the HTML to prepend before the URL
endTag the HTML to append after the URL

static void addScriptCodeInHead ( WOResponse  response,
WOContext  context,
String  script,
String  scriptName 
) [static]

Adds javascript code in a script tag in the html head tag or inline if the request is an Ajax request.

Parameters:
response the response to write into
script the javascript code to insert
scriptName the name of the script to insert (for duplicate checking)

static void addScriptCodeInHead ( WOResponse  response,
WOContext  context,
String  script 
) [static]

Adds javascript code in a script tag in the html head tag (without a name). If you call this method multiple times with the same script code, it will add multiple times. To prevent this, call addScriptCodeInHead(WOResponse, String, String) passing in a name for your script.

Parameters:
response the response to write into
script the javascript code to insert

static void addScriptResourceInHead ( WOResponse  response,
WOContext  context,
String  framework,
String  fileName 
) [static]

Adds a script tag with a correct resource url into the html head tag if it isn't already present in the response, or inserts an Ajax OnDemand tag if the current request is an Ajax request.

Parameters:
response the response
context the context
framework the framework that contains the file
fileName the name of the javascript file to add

static void addStylesheetResourceInHead ( WOResponse  response,
WOContext  context,
String  framework,
String  fileName,
String  media 
) [static]

Adds a stylesheet link tag with a correct resource url in the html head tag if it isn't already present in the response.

Parameters:
context the context
response the response
framework the framework that contains the file
fileName the name of the css file to add
media the media type of the stylesheet (or null for default)

static void addStylesheetResourceInHead ( WOResponse  response,
WOContext  context,
String  framework,
String  fileName 
) [static]

Adds a stylesheet link tag with a correct resource url in the html head tag if it isn't already present in the response.

Parameters:
context the context
response the response
framework the framework that contains the file
fileName the name of the css file to add

static NSMutableDictionary<String, Object> ajaxPageUserInfo ( WOContext  context  )  [static]

Returns the page userInfo for the page component of the given context. If this is the first request for the page user info for a non-ajax request, the user info will be cleared (so that reloading a page doesn't make the system believe it has already rendered script and css tags, for instance). If you do not want this behavior, use pageUserInfo(WOContext) instead.

Parameters:
context the context to lookup
Returns:
the user info for the page component of the given context

static boolean insertInResponseBeforeHead ( WOResponse  response,
WOContext  context,
String  content,
TagMissingBehavior  tagMissingBehavior 
) [static]

Utility to add the given content into the response before the close of the head tag.

Parameters:
response the WOResponse
context the WOContext
content the content to insert.
tagMissingBehavior how to handle the case where the tag is missing
Returns:
whether or not the content was inserted

static boolean insertInResponseBeforeTag ( WOResponse  response,
WOContext  context,
String  content,
String  tag,
TagMissingBehavior  tagMissingBehavior 
) [static]

Utility to add the given content into the response before a particular HTML tag.

Parameters:
response the WOResponse
context the WOContext
content the content to insert.
tag the tag to insert before (in html syntax)
tagMissingBehavior how to handle the case where the tag is missing
Returns:
whether or not the content was inserted

static boolean isResourceAddedToHead ( WOContext  context,
String  frameworkName,
String  resourceName 
) [static]

Returns whether or not the given resource has been added to the HEAD tag.

Parameters:
resourceName the name of the resource to check
Returns:
true if the resource has been added to head

static NSMutableDictionary<String, Object> pageUserInfo ( WOComponent  page  )  [static]

Returns the page userInfo for the given page component. Unlike ajaxPageUserInfo, information put into pageUserInfo will stay associated with the page as long as the page exists.

Parameters:
page the component to lookup
Returns:
the user info for the page component of the given context

static NSMutableDictionary<String, Object> pageUserInfo ( WOContext  context  )  [static]

Returns the page userInfo for the page component of the given context. Unlike ajaxPageUserInfo, information put into pageUserInfo will stay associated with the page as long as the page exists.

Parameters:
context the context to lookup
Returns:
the user info for the page component of the given context

static void replaceAllInResponse ( WOResponse  response,
WOContext  context,
Pattern  pattern,
String  replacement 
) [static]

Replaces all occurrences of the given pattern in the response with the replacement string.

Parameters:
response the response
context the context
pattern the pattern to match
replacement the replacement value

static void replaceFirstInResponse ( WOResponse  response,
WOContext  context,
Pattern  pattern,
String  replacement 
) [static]

Replaces the first occurrence of the given pattern in the response with the replacement string.

Parameters:
response the response
context the context
pattern the pattern to match
replacement the replacement value

static void resourceAddedToHead ( WOContext  context,
String  frameworkName,
String  resourceName 
) [static]

Records that the given resource (within the given framework) has been added to the head of this page.

Parameters:
context the WOContext
frameworkName the framework name of the resource
resourceName the name of the resource

static NSMutableSet<String> resourcesAddedToHead ( WOContext  context  )  [static]

Returns the resources that have been added to the head of this page.

Parameters:
context the WOContext
Returns:
the resources that have been added to the head of this page.

static void setDelegate ( ERXResponseRewriter.Delegate  delegate  )  [static]

Sets the response rewriter delegate to be used by this Application.

Parameters:
delegate the response rewriter delegate to be used by this Application, or null to use the default


Member Data Documentation

Map<WOComponent, NSMutableDictionary<String, Object> > _ajaxPageUserInfos [static, private]

Delegate _delagate [static, private]

Map<WOComponent, NSMutableDictionary<String, Object> > _pageUserInfos [static, private]

final String ADDED_RESOURCES_KEY = "ERXResponseRewriter.addedResources" [static, private]

final String CONTEXT_OBSERVER_KEY = "ERXResponseRewriter.contextObserver" [static, private]

final Logger log = Logger.getLogger(ERXResponseRewriter.class) [static]

final String ORIGINAL_CONTEXT_ID_KEY = "_originalContextID" [static, private]

final String PENDING_INSERTS_KEY = "ERXResponseRewriter.pendingInserts" [static, private]

final String SECURE_RESOURCES_KEY = "er.ajax.secureResources" [static, private]

final String TOP_INDEX_KEY = "ERXResponseRewriter.topIndex" [static, private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:02 2012 for Project Wonder by  doxygen 1.5.8