|
Project Wonder 5.0.0.8794 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecter.extensions.appserver.ERXResponseRewriter
public class ERXResponseRewriter
ERXResponseRewriter provides several utilities for manipulating a WOResponse after it has already been "drawn" by previous components.
| Properties | |
er.extensions.loadOnDemand | if true, javascript files included in Ajax responses will be loaded on-demand (defaults to true) |
er.ajax.secureResources | if true, load all resources with https (default false) |
er.ajax.AJComponent.htmlCloseHead | the tag to insert in front of (defaults to </head>) |
er.extensions.ERXResponseRewriter.javascriptTypeAttribute | if true, type="text/javascript" will be added to injected script tags (defaults true) |
| Nested Class Summary | |
|---|---|
static interface |
ERXResponseRewriter.Delegate
The delegate that is called prior to adding resources into the page, which gives you a chance to deny the addition, or rewrite the addition to a custom resource. |
static class |
ERXResponseRewriter.Resource
Represents a resource in a framework, or a fully-qualified URL if fileName starts with a / or contains :// . |
static class |
ERXResponseRewriter.TagMissingBehavior
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). |
| Field Summary | |
|---|---|
static Logger |
log
|
| Constructor Summary | |
|---|---|
ERXResponseRewriter()
|
|
| Method Summary | |
|---|---|
static String |
_htmlCloseHeadTag()
Returns the tag name that scripts and resources should be inserted above. |
static void |
addResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String startTag,
String endTag)
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. |
static boolean |
addResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String startTag,
String endTag,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
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. |
static boolean |
addResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String startTag,
String endTag,
String fallbackStartTag,
String fallbackEndTag,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
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. |
static void |
addScriptCodeInHead(WOResponse response,
WOContext context,
String script)
Adds javascript code in a script tag in the html head tag (without a name). |
static void |
addScriptCodeInHead(WOResponse response,
WOContext context,
String script,
String scriptName)
Adds javascript code in a script tag in the html head tag or inline if the request is an Ajax request. |
static void |
addScriptResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName)
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. |
static void |
addStylesheetResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName)
Adds a stylesheet link tag with a correct resource url in the html head tag if it isn't already present in the response. |
static void |
addStylesheetResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String media)
Adds a stylesheet link tag with a correct resource url in the html head tag if it isn't already present in the response. |
static NSMutableDictionary<String,Object> |
ajaxPageUserInfo(WOContext context)
Returns the page userInfo for the page component of the given context. |
static boolean |
insertInResponseBeforeHead(WOResponse response,
WOContext context,
String content,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
Utility to add the given content into the response before the close of the head tag. |
static boolean |
insertInResponseBeforeTag(WOResponse response,
WOContext context,
String content,
String tag,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
Utility to add the given content into the response before a particular HTML tag. |
static boolean |
isResourceAddedToHead(WOContext context,
String frameworkName,
String resourceName)
Returns whether or not the given resource has been added to the HEAD tag. |
static NSMutableDictionary<String,Object> |
pageUserInfo(WOContext context)
Returns the page userInfo for the page component of the given context. |
static void |
replaceAllInResponse(WOResponse response,
WOContext context,
Pattern pattern,
String replacement)
Replaces all occurrences of the given pattern in the response with the replacement string. |
static void |
replaceFirstInResponse(WOResponse response,
WOContext context,
Pattern pattern,
String replacement)
Replaces the first occurrence of the given pattern in the response with the replacement string. |
static void |
resourceAddedToHead(WOContext context,
String frameworkName,
String resourceName)
Records that the given resource (within the given framework) has been added to the head of this page. |
static NSMutableSet<String> |
resourcesAddedToHead(WOContext context)
Returns the resources that have been added to the head of this page. |
static void |
setDelegate(ERXResponseRewriter.Delegate delegate)
Sets the response rewriter delegate to be used by this Application. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Logger log
| Constructor Detail |
|---|
public ERXResponseRewriter()
| Method Detail |
|---|
public static void setDelegate(ERXResponseRewriter.Delegate delegate)
delegate - the response rewriter delegate to be used by this Application,
or null to use the defaultpublic static NSMutableDictionary<String,Object> ajaxPageUserInfo(WOContext context)
context - the context to lookup
public static NSMutableDictionary<String,Object> pageUserInfo(WOContext context)
context - the context to lookup
public static String _htmlCloseHeadTag()
public static boolean insertInResponseBeforeHead(WOResponse response,
WOContext context,
String content,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
response - the WOResponsecontext - the WOContextcontent - the content to insert.tagMissingBehavior - how to handle the case where the tag is missing
public static void replaceAllInResponse(WOResponse response,
WOContext context,
Pattern pattern,
String replacement)
response - the responsecontext - the contextpattern - the pattern to matchreplacement - the replacement value
public static void replaceFirstInResponse(WOResponse response,
WOContext context,
Pattern pattern,
String replacement)
response - the responsecontext - the contextpattern - the pattern to matchreplacement - the replacement value
public static boolean insertInResponseBeforeTag(WOResponse response,
WOContext context,
String content,
String tag,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
response - the WOResponsecontext - the WOContextcontent - the content to insert.tag - the tag to insert before (in html syntax)tagMissingBehavior - how to handle the case where the tag is missing
public static void addScriptResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName)
response - the responsecontext - the contextframework - the framework that contains the filefileName - the name of the javascript file to add
public static void addStylesheetResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName)
context - the contextresponse - the responseframework - the framework that contains the filefileName - the name of the css file to add
public static void addStylesheetResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String media)
context - the contextresponse - the responseframework - the framework that contains the filefileName - the name of the css file to addmedia - the media type of the stylesheet (or null for default)
public static void addScriptCodeInHead(WOResponse response,
WOContext context,
String script)
response - the response to write intoscript - the javascript code to insert
public static void addScriptCodeInHead(WOResponse response,
WOContext context,
String script,
String scriptName)
response - the response to write intoscript - the javascript code to insertscriptName - the name of the script to insert (for duplicate checking)
public static void addResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String startTag,
String endTag)
context - the contextresponse - the responseframework - the framework that contains the filefileName - the name of the file to addstartTag - the HTML to prepend before the URLendTag - the HTML to append after the URLpublic static NSMutableSet<String> resourcesAddedToHead(WOContext context)
context - the WOContext
public static boolean isResourceAddedToHead(WOContext context,
String frameworkName,
String resourceName)
resourceName - the name of the resource to check
public static void resourceAddedToHead(WOContext context,
String frameworkName,
String resourceName)
context - the WOContextframeworkName - the framework name of the resourceresourceName - the name of the resource
public static boolean addResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String startTag,
String endTag,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
response - fileName - startTag - endTag -
public static boolean addResourceInHead(WOResponse response,
WOContext context,
String framework,
String fileName,
String startTag,
String endTag,
String fallbackStartTag,
String fallbackEndTag,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
response - context - framework - fileName - startTag - endTag - fallbackStartTag - fallbackEndTag - tagMissingBehavior -
|
Last updated: Thu, Jan 8, 2009 12:32 PM EST | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||