| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * HttpUtil.java | 2  * HttpUtil.java | 
| 3  * | 3  * | 
| 4  * Brazil project web application toolkit, | 4  * Brazil project web application toolkit, | 
| 5  * export version: 2.3 | 5  * export version: 2.3 | 
| 6  * Copyright (c) 1999-2004 Sun Microsystems, Inc. | 6  * Copyright (c) 1999-2004 Sun Microsystems, Inc. | 
| 7  * | 7  * | 
| 8  * Sun Public License Notice | 8  * Sun Public License Notice | 
| 9  * | 9  * | 
| 10  * The contents of this file are subject to the Sun Public License Version | 10  * The contents of this file are subject to the Sun Public License Version | 
| 11  * 1.0 (the "License"). You may not use this file except in compliance with | 11  * 1.0 (the "License"). You may not use this file except in compliance with | 
| 12  * the License. A copy of the License is included as the file "license.terms", | 12  * the License. A copy of the License is included as the file "license.terms", | 
| 13  * and also available at http://www.sun.com/ | 13  * and also available at http://www.sun.com/ | 
| 14  * | 14  * | 
| 15  * The Original Code is from: | 15  * The Original Code is from: | 
| 16  *    Brazil project web application toolkit release 2.3. | 16  *    Brazil project web application toolkit release 2.3. | 
| 17  * The Initial Developer of the Original Code is: cstevens. | 17  * The Initial Developer of the Original Code is: cstevens. | 
| 18  * Portions created by cstevens are Copyright (C) Sun Microsystems, Inc. | 18  * Portions created by cstevens are Copyright (C) Sun Microsystems, Inc. | 
| 19  * All Rights Reserved. | 19  * All Rights Reserved. | 
| 20  * | 20  * | 
| 21  * Contributor(s): cstevens, guym, suhler. | 21  * Contributor(s): cstevens, guym, suhler. | 
| 22  * | 22  * | 
| 23  * Version:  2.3 | 23  * Version:  2.3 | 
| 24  * Created by cstevens on 99/09/15 | 24  * Created by cstevens on 99/09/15 | 
| 25  * Last modified by suhler on 04/11/30 15:19:46 | 25  * Last modified by suhler on 04/11/30 15:19:46 | 
| 26  * | 26  * | 
| 27  * Version Histories: | 27  * Version Histories: | 
| 28  * | 28  * | 
|  | 29  * unversioned 12/11/27-15:37:00 (Andrey Novikov) | 
|  | 30  *   fixed StringIndexOutOfBoundsException in formatTime(long time) | 
|  | 31  * | 
| 29  * 2.3 04/11/30-15:19:46 (suhler) | 32  * 2.3 04/11/30-15:19:46 (suhler) | 
| 30  *   fixed sccs version string | 33  *   fixed sccs version string | 
| 31  * | 34  * | 
| 32  * 2.2 03/08/01-16:17:39 (suhler) | 35  * 2.2 03/08/01-16:17:39 (suhler) | 
| 33  *   fixes for javadoc | 36  *   fixes for javadoc | 
| 34  * | 37  * | 
| 35  * 2.1 02/10/01-16:37:05 (suhler) | 38  * 2.1 02/10/01-16:37:05 (suhler) | 
| 36  *   version change | 39  *   version change | 
| 37  * | 40  * | 
| 38  * 1.14 02/07/29-14:57:34 (suhler) | 41  * 1.14 02/07/29-14:57:34 (suhler) | 
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 284      * Returns a string containing an HTTP-formatted date. | 287      * Returns a string containing an HTTP-formatted date. | 
| 285      * | 288      * | 
| 286      * @param   time | 289      * @param   time | 
| 287      *          The date to format (current time in msec). | 290      *          The date to format (current time in msec). | 
| 288      * | 291      * | 
| 289      * @return  HTTP date string representing the given time. | 292      * @return  HTTP date string representing the given time. | 
| 290      */ | 293      */ | 
| 291     public static String | 294     public static String | 
| 292     formatTime(long time) | 295     formatTime(long time) | 
| 293     { | 296     { | 
| 294 »       return dateFormat.format(new Date(time)).substring(0, 29); | 297     String date = dateFormat.format(new Date(time)); | 
|  | 298     int plus = date.indexOf('+'); | 
|  | 299     if (plus > 0) | 
|  | 300       date = date.substring(0, plus); | 
|  | 301 »       return date; | 
| 295     } | 302     } | 
| 296 | 303 | 
| 297     /** | 304     /** | 
| 298      * Convert a last-modified date in "standard" format | 305      * Convert a last-modified date in "standard" format | 
| 299      * into a time stamp.  This "inverses" formatTime. | 306      * into a time stamp.  This "inverses" formatTime. | 
| 300      * | 307      * | 
| 301      * @param           time | 308      * @param           time | 
| 302      *                  A correctly formatted HTTP date string. | 309      *                  A correctly formatted HTTP date string. | 
| 303      * @return          milliseconds since the epoch, or 0 if the conversion | 310      * @return          milliseconds since the epoch, or 0 if the conversion | 
| 304      *                  failed. | 311      *                  failed. | 
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 442             case 500:   return "Server Error"; | 449             case 500:   return "Server Error"; | 
| 443             case 501:   return "Not Implemented"; | 450             case 501:   return "Not Implemented"; | 
| 444             case 502:   return "Bad Gateway"; | 451             case 502:   return "Bad Gateway"; | 
| 445             case 503:   return "Service Unavailable"; | 452             case 503:   return "Service Unavailable"; | 
| 446             case 504:   return "Gateway Time-out"; | 453             case 504:   return "Gateway Time-out"; | 
| 447             case 505:   return "HTTP Version not supported"; | 454             case 505:   return "HTTP Version not supported"; | 
| 448             default:    return "Error"; | 455             default:    return "Error"; | 
| 449         } | 456         } | 
| 450     } | 457     } | 
| 451 } | 458 } | 
| OLD | NEW | 
|---|