tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r528897 - /tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/RequestUtil.java
Date Sun, 15 Apr 2007 00:24:50 GMT
Author: markt
Date: Sat Apr 14 17:24:49 2007
New Revision: 528897

URL: http://svn.apache.org/viewvc?view=rev&rev=528897
Log:
Remove old, unused utility methods.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/RequestUtil.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/RequestUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/RequestUtil.java?view=diff&rev=528897&r1=528896&r2=528897
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/RequestUtil.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/RequestUtil.java Sat Apr 14 17:24:49
2007
@@ -20,12 +20,9 @@
 
 import java.io.UnsupportedEncodingException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
 import java.util.Map;
 import java.util.TimeZone;
 
-import javax.servlet.http.Cookie;
-
 
 /**
  * General purpose request parsing and encoding utility methods.
@@ -50,58 +47,6 @@
 
 
     /**
-     * Encode a cookie as per RFC 2109.  The resulting string can be used
-     * as the value for a <code>Set-Cookie</code> header.
-     *
-     * @param cookie The cookie to encode.
-     * @return A string following RFC 2109.
-     */
-    public static String encodeCookie(Cookie cookie) {
-
-        StringBuffer buf = new StringBuffer( cookie.getName() );
-        buf.append("=");
-        buf.append(cookie.getValue());
-
-        if (cookie.getComment() != null) {
-            buf.append("; Comment=\"");
-            buf.append(cookie.getComment());
-            buf.append("\"");
-        }
-
-        if (cookie.getDomain() != null) {
-            buf.append("; Domain=\"");
-            buf.append(cookie.getDomain());
-            buf.append("\"");
-        }
-
-        long age = cookie.getMaxAge();
-        if (cookie.getMaxAge() >= 0) {
-            buf.append("; Max-Age=\"");
-            buf.append(cookie.getMaxAge());
-            buf.append("\"");
-        }
-
-        if (cookie.getPath() != null) {
-            buf.append("; Path=\"");
-            buf.append(cookie.getPath());
-            buf.append("\"");
-        }
-
-        if (cookie.getSecure()) {
-            buf.append("; Secure");
-        }
-
-        if (cookie.getVersion() > 0) {
-            buf.append("; Version=\"");
-            buf.append(cookie.getVersion());
-            buf.append("\"");
-        }
-
-        return (buf.toString());
-    }
-
-
-    /**
      * Filter the specified message string for characters that are sensitive
      * in HTML.  This avoids potential attacks caused by including JavaScript
      * codes in the request URL that is often reported in error messages.
@@ -199,72 +144,6 @@
 
 
     /**
-     * Parse the character encoding from the specified content type header.
-     * If the content type is null, or there is no explicit character encoding,
-     * <code>null</code> is returned.
-     *
-     * @param contentType a content type header
-     */
-    public static String parseCharacterEncoding(String contentType) {
-
-        if (contentType == null)
-            return (null);
-        int start = contentType.indexOf("charset=");
-        if (start < 0)
-            return (null);
-        String encoding = contentType.substring(start + 8);
-        int end = encoding.indexOf(';');
-        if (end >= 0)
-            encoding = encoding.substring(0, end);
-        encoding = encoding.trim();
-        if ((encoding.length() > 2) && (encoding.startsWith("\""))
-            && (encoding.endsWith("\"")))
-            encoding = encoding.substring(1, encoding.length() - 1);
-        return (encoding.trim());
-
-    }
-
-
-    /**
-     * Parse a cookie header into an array of cookies according to RFC 2109.
-     *
-     * @param header Value of an HTTP "Cookie" header
-     */
-    public static Cookie[] parseCookieHeader(String header) {
-
-        if ((header == null) || (header.length() < 1))
-            return (new Cookie[0]);
-
-        ArrayList cookies = new ArrayList();
-        while (header.length() > 0) {
-            int semicolon = header.indexOf(';');
-            if (semicolon < 0)
-                semicolon = header.length();
-            if (semicolon == 0)
-                break;
-            String token = header.substring(0, semicolon);
-            if (semicolon < header.length())
-                header = header.substring(semicolon + 1);
-            else
-                header = "";
-            try {
-                int equals = token.indexOf('=');
-                if (equals > 0) {
-                    String name = token.substring(0, equals).trim();
-                    String value = token.substring(equals+1).trim();
-                    cookies.add(new Cookie(name, value));
-                }
-            } catch (Throwable e) {
-                ;
-            }
-        }
-
-        return ((Cookie[]) cookies.toArray(new Cookie[cookies.size()]));
-
-    }
-
-
-    /**
      * Append request parameters from the specified String to the specified
      * Map.  It is presumed that the specified Map is not accessed from any
      * other thread, so no synchronization is performed.
@@ -461,7 +340,6 @@
         throws UnsupportedEncodingException {
 
         if (data != null && data.length > 0) {
-            int    pos = 0;
             int    ix = 0;
             int    ox = 0;
             String key = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message