dgraham     2003/07/30 17:30:21

  Modified:    src/share/org/apache/struts/util ResponseUtils.java
               src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Moved filter() method to TagUtils.  ResponseUtils doesn't have any
  methods left.
  
  Revision  Changes    Path
  1.8       +11 -43    
jakarta-struts/src/share/org/apache/struts/util/ResponseUtils.java
  
  Index: ResponseUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/ResponseUtils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ResponseUtils.java        31 Jul 2003 00:19:04 -0000      1.7
  +++ ResponseUtils.java        31 Jul 2003 00:30:21 -0000      1.8
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -59,24 +59,22 @@
    *
    */
   
  -
   package org.apache.struts.util;
   
  -
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   
   import org.apache.struts.taglib.TagUtils;
   
  -
   /**
    * General purpose utility methods related to generating a servlet response
    * in the Struts controller framework.
    *
    * @author Craig R. McClanahan
    * @version $Revision$ $Date$
  + * @deprecated Use the corresponding TagUtils methods instead.  
  + * This class will be removed after Struts 1.2.
    */
  -
   public class ResponseUtils {
   
   
  @@ -101,38 +99,10 @@
        * by the corresponding character entities.
        *
        * @param value The string to be filtered and returned
  +     * @deprecated
        */
       public static String filter(String value) {
  -
  -        if (value == null)
  -            return (null);
  -
  -        char content[] = new char[value.length()];
  -        value.getChars(0, value.length(), content, 0);
  -        StringBuffer result = new StringBuffer(content.length + 50);
  -        for (int i = 0; i < content.length; i++) {
  -            switch (content[i]) {
  -            case '<':
  -                result.append("&lt;");
  -                break;
  -            case '>':
  -                result.append("&gt;");
  -                break;
  -            case '&':
  -                result.append("&amp;");
  -                break;
  -            case '"':
  -                result.append("&quot;");
  -                break;
  -            case '\'':
  -                result.append("&#39;");
  -                break;
  -            default:
  -                result.append(content[i]);
  -            }
  -        }
  -        return (result.toString());
  -
  +        return TagUtils.getInstance().filter(value);
       }
   
   
  @@ -147,8 +117,7 @@
        * @param text The text to be written
        *
        * @exception JspException if an input/output error occurs (already saved)
  -     * @deprecated Use TagUtils.write() instead.  This will be 
  -     * removed after Struts 1.2.
  +     * @deprecated
        */
       public static void write(PageContext pageContext, String text)
           throws JspException {
  @@ -166,8 +135,7 @@
        * @param text The text to be written
        *
        * @exception JspException if an input/output error occurs (already saved)
  -     * @deprecated Use TagUtils.writePrevious() instead.  This will be 
  -     * removed after Struts 1.2.
  +     * @deprecated
        */
       public static void writePrevious(PageContext pageContext, String text)
           throws JspException {
  
  
  
  1.17      +46 -4     jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TagUtils.java     31 Jul 2003 00:19:04 -0000      1.16
  +++ TagUtils.java     31 Jul 2003 00:30:21 -0000      1.17
  @@ -531,6 +531,48 @@
            }
   
       }
  +    
  +    /**
  +     * Filter the specified string for characters that are senstive to
  +     * HTML interpreters, returning the string with these characters replaced
  +     * by the corresponding character entities.
  +     *
  +     * @param value The string to be filtered and returned
  +     */
  +    public String filter(String value) {
  +
  +        if (value == null) {
  +            return (null);
  +        }
  +
  +        char content[] = new char[value.length()];
  +        value.getChars(0, value.length(), content, 0);
  +        StringBuffer result = new StringBuffer(content.length + 50);
  +        
  +        for (int i = 0; i < content.length; i++) {
  +            switch (content[i]) {
  +            case '<':
  +                result.append("&lt;");
  +                break;
  +            case '>':
  +                result.append("&gt;");
  +                break;
  +            case '&':
  +                result.append("&amp;");
  +                break;
  +            case '"':
  +                result.append("&quot;");
  +                break;
  +            case '\'':
  +                result.append("&#39;");
  +                break;
  +            default:
  +                result.append(content[i]);
  +            }
  +        }
  +        
  +        return result.toString();
  +    }
   
       /**
        * Retrieves the value from request scope and if it isn't already an
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to