Apache Struts API Documentation: Class ResponseUtils

Apache Struts API


org.apache.struts.util Class ResponseUtils

java.lang.Object
  |
  +--org.apache.struts.util.ResponseUtils

public class ResponseUtils
extends java.lang.Object

General purpose utility methods related to generating a servlet response in the Struts controller framework.

Version:
$Rev: 164747 $ $Date: 2005-04-26 06:47:48 +0100 (Tue, 26 Apr 2005) $

Field Summary
private static java.lang.reflect.Method encode
          Java 1.4 encode method to use instead of deprecated 1.3 version.
private static org.apache.commons.logging.Log log
          Commons logging instance.
protected static MessageResources messages
          The message resources for this package.
 
Constructor Summary
ResponseUtils()
           
 
Method Summary
(package private) static void ()">()
          Initialize the encode variable with the Java 1.4 method if available.
static java.lang.String encodeURL(java.lang.String url)
          URLencodes a string assuming the character encoding is UTF-8.
static java.lang.String encodeURL(java.lang.String url, java.lang.String enc)
          Use the new URLEncoder.encode() method from Java 1.4 if available, else use the old deprecated version.
static java.lang.String filter(java.lang.String value)
          Filter the specified string for characters that are sensitive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.
static void write(javax.servlet.jsp.PageContext pageContext, java.lang.String text)
          Deprecated. use TagUtils.write() method instead. This method will be removed after Struts 1.2.
static void writePrevious(javax.servlet.jsp.PageContext pageContext, java.lang.String text)
          Deprecated. use TagUtils.writePrevious() method instead. This method will be removed after Struts 1.2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

messages

protected static MessageResources messages
The message resources for this package.

encode

private static java.lang.reflect.Method encode
Java 1.4 encode method to use instead of deprecated 1.3 version.

log

private static final org.apache.commons.logging.Log log
Commons logging instance.
Constructor Detail

ResponseUtils

public ResponseUtils()
Method Detail
()">

static void ()
Initialize the encode variable with the Java 1.4 method if available.

filter

public static java.lang.String filter(java.lang.String value)
Filter the specified string for characters that are sensitive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.
Parameters:
value - The string to be filtered and returned

encodeURL

public static java.lang.String encodeURL(java.lang.String url)

URLencodes a string assuming the character encoding is UTF-8.

Parameters:
url -  
Returns:
String The encoded url in UTF-8

encodeURL

public static java.lang.String encodeURL(java.lang.String url,
                                         java.lang.String enc)
Use the new URLEncoder.encode() method from Java 1.4 if available, else use the old deprecated version. This method uses reflection to find the appropriate method; if the reflection operations throw exceptions, this will return the url encoded with the old URLEncoder.encode() method.
Parameters:
enc - The character encoding the urlencode is performed on.
Returns:
String The encoded url.

write

public static void write(javax.servlet.jsp.PageContext pageContext,
                         java.lang.String text)
                  throws javax.servlet.jsp.JspException
Deprecated. use TagUtils.write() method instead. This method will be removed after Struts 1.2.

Write the specified text as the response to the writer associated with this page. WARNING - If you are writing body content from the doAfterBody() method of a custom tag class that implements BodyTag, you should be calling writePrevious() instead.
Parameters:
pageContext - The PageContext object for this page
text - The text to be written
Throws:
javax.servlet.jsp.JspException - if an input/output error occurs (already saved)

writePrevious

public static void writePrevious(javax.servlet.jsp.PageContext pageContext,
                                 java.lang.String text)
                          throws javax.servlet.jsp.JspException
Deprecated. use TagUtils.writePrevious() method instead. This method will be removed after Struts 1.2.

Write the specified text as the response to the writer associated with the body content for the tag within which we are currently nested.
Parameters:
pageContext - The PageContext object for this page
text - The text to be written
Throws:
javax.servlet.jsp.JspException - if an input/output error occurs (already saved)


Copyright © 2000-2005 - The Apache Software Foundation