|
Project Wonder 5.0 | |||||||||||
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 class |
ERXResponseRewriter.ContextObserver
ERXResponseRewriter uses the ContextObserver to reset the topIndex value at the end of the request. |
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 org.apache.log4j.Logger |
log
|
Constructor Summary | |
---|---|
ERXResponseRewriter()
|
Method Summary | |
---|---|
static java.lang.String |
_htmlCloseHeadTag()
Returns the tag name that scripts and resources should be inserted above. |
static void |
addResourceInHead(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String framework,
java.lang.String fileName,
java.lang.String startTag,
java.lang.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(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String framework,
java.lang.String fileName,
java.lang.String startTag,
java.lang.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(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String framework,
java.lang.String fileName,
java.lang.String startTag,
java.lang.String endTag,
java.lang.String fallbackStartTag,
java.lang.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(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String script)
Adds javascript code in a script tag in the html head tag (without a name). |
static void |
addScriptCodeInHead(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String script,
java.lang.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(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String framework,
java.lang.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(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String framework,
java.lang.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(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String framework,
java.lang.String fileName,
java.lang.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 com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> |
ajaxPageUserInfo(com.webobjects.appserver.WOContext context)
Returns the page userInfo for the page component of the given context. |
static boolean |
insertInResponseBeforeHead(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String content,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
Utility to add the given content into the response before the close of the head tag. |
static boolean |
insertInResponseBeforeTag(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String content,
java.lang.String tag,
ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
Utility to add the given content into the response before a particular HTML tag. |
static boolean |
isResourceAddedToHead(com.webobjects.appserver.WOContext context,
java.lang.String frameworkName,
java.lang.String resourceName)
Returns whether or not the given resource has been added to the HEAD tag. |
static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> |
pageUserInfo(com.webobjects.appserver.WOComponent page)
Returns the page userInfo for the given page component. |
static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> |
pageUserInfo(com.webobjects.appserver.WOContext context)
Returns the page userInfo for the page component of the given context. |
static void |
replaceAllInResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.util.regex.Pattern pattern,
java.lang.String replacement)
Replaces all occurrences of the given pattern in the response with the replacement string. |
static void |
replaceFirstInResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.util.regex.Pattern pattern,
java.lang.String replacement)
Replaces the first occurrence of the given pattern in the response with the replacement string. |
static void |
resourceAddedToHead(com.webobjects.appserver.WOContext context,
java.lang.String frameworkName,
java.lang.String resourceName)
Records that the given resource (within the given framework) has been added to the head of this page. |
static com.webobjects.foundation.NSMutableSet<java.lang.String> |
resourcesAddedToHead(com.webobjects.appserver.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 org.apache.log4j.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 com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> ajaxPageUserInfo(com.webobjects.appserver.WOContext context)
context
- the context to lookup
public static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> pageUserInfo(com.webobjects.appserver.WOContext context)
context
- the context to lookup
public static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> pageUserInfo(com.webobjects.appserver.WOComponent page)
page
- the component to lookup
public static java.lang.String _htmlCloseHeadTag()
public static boolean insertInResponseBeforeHead(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.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(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.util.regex.Pattern pattern, java.lang.String replacement)
response
- the responsecontext
- the contextpattern
- the pattern to matchreplacement
- the replacement valuepublic static void replaceFirstInResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.util.regex.Pattern pattern, java.lang.String replacement)
response
- the responsecontext
- the contextpattern
- the pattern to matchreplacement
- the replacement valuepublic static boolean insertInResponseBeforeTag(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String content, java.lang.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(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String framework, java.lang.String fileName)
response
- the responsecontext
- the contextframework
- the framework that contains the filefileName
- the name of the javascript file to addpublic static void addStylesheetResourceInHead(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String framework, java.lang.String fileName)
context
- the contextresponse
- the responseframework
- the framework that contains the filefileName
- the name of the css file to addpublic static void addStylesheetResourceInHead(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String framework, java.lang.String fileName, java.lang.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(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String script)
response
- the response to write intoscript
- the javascript code to insertpublic static void addScriptCodeInHead(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String script, java.lang.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(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String framework, java.lang.String fileName, java.lang.String startTag, java.lang.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 com.webobjects.foundation.NSMutableSet<java.lang.String> resourcesAddedToHead(com.webobjects.appserver.WOContext context)
context
- the WOContext
public static boolean isResourceAddedToHead(com.webobjects.appserver.WOContext context, java.lang.String frameworkName, java.lang.String resourceName)
resourceName
- the name of the resource to check
public static void resourceAddedToHead(com.webobjects.appserver.WOContext context, java.lang.String frameworkName, java.lang.String resourceName)
context
- the WOContextframeworkName
- the framework name of the resourceresourceName
- the name of the resourcepublic static boolean addResourceInHead(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String framework, java.lang.String fileName, java.lang.String startTag, java.lang.String endTag, ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
response
- fileName
- startTag
- endTag
-
public static boolean addResourceInHead(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String framework, java.lang.String fileName, java.lang.String startTag, java.lang.String endTag, java.lang.String fallbackStartTag, java.lang.String fallbackEndTag, ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
response
- context
- framework
- fileName
- startTag
- endTag
- fallbackStartTag
- fallbackEndTag
- tagMissingBehavior
-
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |