You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sa...@apache.org on 2002/02/22 19:14:31 UTC

cvs commit: jakarta-commons-sandbox/http/src/java/org/apache/commons/http BrowserDetector.java HttpUtils.java

sanders     02/02/22 10:14:31

  Added:       http     PROPOSAL.html RELEASE-NOTES.txt STATUS.html
                        build.properties.sample build.xml
               http/src/conf MANIFEST.MF
               http/src/java/org/apache/commons/http BrowserDetector.java
                        HttpUtils.java
  Log:
  New resting place for http-related utilities
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/http/PROPOSAL.html
  
  Index: PROPOSAL.html
  ===================================================================
  <html>
  <head>
  <title>Proposal for http Package</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Proposal for <em>http</em> Package</h1>
  </div>
  
  <h3>(0) Rationale</h3>
  
  <p>Many software projects have a need to blah blah blah.  The http
  package seeks to encapsulate some  blah blah blah
  </p>
  
  
  <h3>(1) Scope of the Package</h3>
  
  <p>This proposal is to create a package of Java utility classes for
  various types of http related activity.</p>
  
  
  <h3>(1.5) Interaction With Other Packages</h3>
  
  <p><em>http</em> relies only on standard JDK 1.2 (or later) APIs for
  production deployment.  It utilizes the JUnit unit testing framework for
  developing and executing unit tests, but this is of interest only to
  developers of the component.</p>
  
  <p>No external configuration files are utilized.</p>
  
  
  <h3>(2) Initial Source of the Package</h3>
  
  <p>The original Java classes are splashed around various Apache
  subprojects.  We intend to seek them out and integrate them.</p>
  
  <p>The proposed package name for the new component is
  <code>org.apache.commons.http</code>.</p>
  
  
  <h3>(3)  Required Jakarta-Commons Resources</h3>
  
  <ul>
  <li>CVS Repository - New directory <code>http</code> in the
      <code>jakarta-commons</code> CVS repository.</li>
  <li>Mailing List - Discussions will take place on the general
      <em>commons-dev@jakarta.apache.org</em> mailing list.  To help
      list subscribers identify messages of interest, it is suggested that
      the message subject of messages about this component be prefixed with
      [http].</li>
  <li>Bugzilla - New component "http" under the "Commons" product
      category, with appropriate version identifiers as needed.</li>
  <li>Jyve FAQ - New category "commons-http" (when available).</li>
  </ul>
  
  
  <h3>(4) Initial Committers</h3>
  
  <p>The initial committers on the IO component shall be:
  <ul>
    <li>Your name here</li>
  </ul>
  </p>
  
  
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-commons-sandbox/http/RELEASE-NOTES.txt
  
  Index: RELEASE-NOTES.txt
  ===================================================================
  $Id: RELEASE-NOTES.txt,v 1.1 2002/02/22 18:14:31 sanders Exp $
  
  			 Commons http Package
  			   Version 1.0-dev
  			    Release Notes
  
  
  INTRODUCTION:
  
  This document contains the release notes for this version of the Commons
  http package, and highlights changes since the previous version.  The
  current release adds new features and bug fixes, and is being done now to
  follow the release early/release often mentality.
  
  
  NEW FEATURES:
  
  * 
  
  
  BUG FIXES:
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/http/STATUS.html
  
  Index: STATUS.html
  ===================================================================
  <html>
  <head>
  <title>Status File for Jakarta Commons "http" Component</title>
  </head>
  <body bgcolor="white">
  
  
  <div align="center">
  <h1>The Jakarta Commons <em>http</em> Component</h1>
  $Id: STATUS.html,v 1.1 2002/02/22 18:14:31 sanders Exp $<br />
  <a href="#Introduction">[Introduction]</a>
  <a href="#Dependencies">[Dependencies]</a>
  <a href="#Release Info">[Release Info]</a>
  <a href="#Committers">[Committers]</a>
  <a href="#Action Items">[Action Items]</a>
  <br /><br />
  </div>
  
  
  <a name="Introduction"></a>
  <h3>1.  INTRODUCTION</h3>
  
  <p>The <em>http</em> Component contains a set of Java classes that provide
  ......The following classes are included:</p>
  <ul>
  <li><strong>TBD</strong> - TBD.</li>
  </ul>
  
  
  <a name="Dependencies"></a>
  <h3>2.  DEPENDENCIES</h3>
  
  <p>The <em>http</em> component is dependent upon the following external
  components for development and use:</p>
  <ul>
  <li><a href="http://java.sun.com/j2se">Java Development Kit</a>
      (Version 1.2 or later)</li>
  <li><a href="http://www.junit.org">JUnit Testing Framework</a>
      (Version 3.7 or later) - for unit tests only, not required
      for deployment</li>
  </ul>
  
  
  <a name="Release Info"></a>
  <h3>3.  RELEASE INFO</h3>
  
  <p>Current Release: http is yet to be released.  We hope it will be RSN.</p>
  
  <p>Planned Next Release:  Real Soon Now :)  See the
  <a href="#Action Items">Action Items</a> list for tasks that need to be
  completed prior to this release.</p>
  
  
  <a name="Committers"></a>
  <h3>4.  COMMITTERS</h3>
  
  <p>The following individuals are the primary developers and maintainers of this
  component.  Developers who plan to use <em>http</em> in their own
  projects are encouraged to collaborate on the future development of this
  component to ensure that it continues to meet a variety of needs.</p>
  <ul>
  <li><a href="mailto:sanders@apache.org">Scott Sanders</a></li>
  <li>Fancy volunteering?  We need you!</li>
  </ul>
  
  
  <a name="Action Items"></a>
  <h3>5.  ACTION ITEMS</h3>
  
  <p>The following action items need to be completed prior to a Version 1.3
  release of this component:</p>
  
  <table border="1">
  
    <tr>
      <th width="80%">Action Item</th>
      <th width="20%">Volunteer</th>
    </tr>
  
    <tr>
      <td><strong>CODE!</strong>.  Add code to make this package useful.</td>
      <td align="center">Everyone</td>
    </tr>
  
  </table>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-commons-sandbox/http/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  # The directory containing your binary distribution of JUnit, 
  # version 3.7 or later
  junit.home = /usr/local/junit3.7
  
  # The pathname of the "junit.jar" JAR file
  junit.jar = ${junit.home}/junit.jar
  
  
  
  1.1                  jakarta-commons-sandbox/http/build.xml
  
  Index: build.xml
  ===================================================================
  <project name="http" default="compile" basedir=".">
  
  
  <!--
          "http" component of the Jakarta Commons Subproject
          $Id: build.xml,v 1.1 2002/02/22 18:14:31 sanders Exp $
  -->
  
  
  <!-- ========== Initialize Properties ===================================== -->
  
  
    <property file="build.properties"/>                <!-- Component local   -->
    <property file="../build.properties"/>             <!-- Commons local     -->
    <property file="${user.home}/build.properties"/>   <!-- User local        -->
  
  
  <!-- ========== External Dependencies ===================================== -->
  
  
    <!-- The directory containing your binary distribution of JUnit,
         version 3.7 or later -->
    <property name="junit.home"              value="/usr/local/junit3.7"/>
  
  
  <!-- ========== Derived Values ============================================ -->
  
  
    <!-- The pathname of the "junit.jar" JAR file -->
    <property name="junit.jar"               value="${junit.home}/junit.jar"/>
  
  
  <!-- ========== Component Declarations ==================================== -->
  
  
    <!-- The name of this component -->
    <property name="component.name"          value="http"/>
  
    <!-- The primary package name of this component -->
    <property name="component.package"       value="org.apache.commons.http"/>
  
    <!-- The title of this component -->
    <property name="component.title"         value="http Utilities"/>
  
    <!-- The current version number of this component -->
    <property name="component.version"       value="1.0-dev"/>
  
    <!-- The base directory for compilation targets -->
    <property name="build.home"              value="target"/>
  
    <!-- The base directory for component configuration files -->
    <property name="conf.home"               value="src/conf"/>
  
    <!-- The base directory for distribution targets -->
    <property name="dist.home"               value="dist"/>
  
    <!-- The base directory for component sources -->
    <property name="source.home"             value="src/java"/>
  
    <!-- The base directory for unit test sources -->
    <property name="test.home"               value="src/test"/>
  
  
  <!-- ========== Compiler Defaults ========================================= -->
  
  
    <!-- Should Java compilations set the 'debug' compiler option? -->
    <property name="compile.debug"           value="true"/>
  
    <!-- Should Java compilations set the 'deprecation' compiler option? -->
    <property name="compile.deprecation"     value="true"/>
  
    <!-- Should Java compilations set the 'optimize' compiler option? -->
    <property name="compile.optimize"        value="true"/>
  
    <!-- Construct compile classpath -->
    <path id="compile.classpath">
      <pathelement location="${build.home}/classes"/>
    </path>
  
  
  <!-- ========== Test Execution Defaults =================================== -->
  
  
    <!-- Construct unit test classpath -->
    <path id="test.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${build.home}/tests"/>
      <pathelement location="${junit.jar}"/>
    </path>
  
    <!-- Should all tests fail if one does? -->
    <property name="test.failonerror"        value="true"/>
  
    <!-- The test runner to execute -->
    <property name="test.runner"             value="junit.textui.TestRunner"/>
  
  
  <!-- ========== Executable Targets ======================================== -->
  
  
    <target name="init"
     description="Initialize and evaluate conditionals">
      <echo message="-------- ${component.name} ${component.version} --------"/>
      <filter  token="name"                  value="${component.name}"/>
      <filter  token="package"               value="${component.package}"/>
      <filter  token="version"               value="${component.version}"/>
    </target>
  
  
    <target name="prepare" depends="init"
     description="Prepare build directory">
      <mkdir dir="${build.home}"/>
      <mkdir dir="${build.home}/classes"/>
      <mkdir dir="${build.home}/conf"/>
      <mkdir dir="${build.home}/tests"/>
    </target>
  
  
    <target name="static" depends="prepare"
     description="Copy static files to build directory">
      <tstamp/>
      <copy  todir="${build.home}/conf" filtering="on">
        <fileset dir="${conf.home}" includes="*.MF"/>
      </copy>
    </target>
  
  
    <target name="compile" depends="static"
     description="Compile shareable components">
      <javac  srcdir="${source.home}"
             destdir="${build.home}/classes"
               debug="${compile.debug}"
         deprecation="${compile.deprecation}"
            optimize="${compile.optimize}">
        <classpath refid="compile.classpath"/>
      </javac>
      <copy    todir="${build.home}/classes" filtering="on">
        <fileset dir="${source.home}" excludes="**/*.java"/>
      </copy>
    </target>
  
  
    <target name="compile.tests" depends="compile"
     description="Compile unit test cases">
      <javac  srcdir="${test.home}"
             destdir="${build.home}/tests"
               debug="${compile.debug}"
         deprecation="${compile.deprecation}"
            optimize="${compile.optimize}">
        <classpath refid="test.classpath"/>
      </javac>
      <copy    todir="${build.home}/tests" filtering="on">
        <fileset dir="${test.home}" excludes="**/*.java"/>
      </copy>
    </target>
  
  
    <target name="clean"
     description="Clean build and distribution directories">
      <delete    dir="${build.home}"/>
      <delete    dir="${dist.home}"/>
    </target>
  
  
    <target name="all" depends="clean,compile"
     description="Clean and compile all components"/>
  
  
    <target name="javadoc" depends="compile"
     description="Create component Javadoc documentation">
      <mkdir      dir="${dist.home}"/>
      <mkdir      dir="${dist.home}/docs"/>
      <mkdir      dir="${dist.home}/docs/api"/>
      <javadoc sourcepath="${source.home}"
                  destdir="${dist.home}/docs/api"
             packagenames="org.apache.commons.*"
                   author="true"
                  private="true"
                  version="true"
                 doctitle="&lt;h1&gt;${component.title}&lt;/h1&gt;"
              windowtitle="${component.title} (Version ${component.version})"
                   bottom="Copyright (c) 2001-2002 - Apache Software Foundation">
        <classpath refid="compile.classpath"/>
      </javadoc>
    </target>
  
  
    <target name="dist" depends="compile,javadoc"
     description="Create binary distribution">
      <mkdir      dir="${dist.home}"/>
      <copy      file="../LICENSE"
                todir="${dist.home}"/>
      <copy      file="RELEASE-NOTES.txt"
                todir="${dist.home}"/>
      <antcall target="jar"/>
    </target>
  
  
    <target name="jar" depends="compile"
     description="Create jar">
      <mkdir      dir="${dist.home}"/>
      <mkdir      dir="${build.home}/classes/META-INF"/>
      <copy      file="../LICENSE"
               tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
      <jar    jarfile="${dist.home}/commons-${component.name}.jar"
              basedir="${build.home}/classes"
             manifest="${build.home}/conf/MANIFEST.MF"/>
    </target>
  
  
    <target name="install-jar" depends="jar"
     description="--> Installs jar file in ${lib.repo}">
      <copy todir="${lib.repo}" filtering="no">
        <fileset dir="${dist.home}">
          <include name="commons-${component.name}.jar"/>
        </fileset>
      </copy>
    </target>
  
  
  <!-- ========== Unit Test Targets ========================================= -->
  
  
    <target name="test"  depends="compile.tests,
                                  test.http"
     description="Run all unit test cases">
    </target>
  
  
    <target name="test.http" depends="compile.tests">
      <echo message="Running http tests ..."/>
      <java classname="${test.runner}" fork="yes"
          failonerror="${test.failonerror}">
        <arg value="org.apache.commons.http.SomeTestCase"/>
        <classpath refid="test.classpath"/>
      </java>
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/http/src/conf/MANIFEST.MF
  
  Index: MANIFEST.MF
  ===================================================================
  Extension-Name: @package@
  Specification-Vendor: Apache Software Foundation
  Specification-Version: 1.0
  Implementation-Vendor: Apache Software Foundation
  Implementation-Version: @version@
  
  
  
  1.1                  jakarta-commons-sandbox/http/src/java/org/apache/commons/http/BrowserDetector.java
  
  Index: BrowserDetector.java
  ===================================================================
  package org.apache.commons.http;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /**
   * This class parses the user agent string and sets javasciptOK and
   * cssOK following the rules described below.  If you want to check
   * for specific browsers/versions then use this class to parse the
   * user agent string and use the accessor methods in this class.
   *
   * JavaScriptOK means that the browser understands JavaScript on the
   * same level the Navigator 3 does.  Specifically, it can use named
   * images.  This allows easier rollovers.  If a browser doesn't do
   * this (Nav 2 or MSIE 3), then we just assume it can't do any
   * JavaScript.  Referencing images by load order is too hard to
   * maintain.
   *
   * CSSOK is kind of sketchy in that Nav 4 and MSIE work differently,
   * but they do seem to have most of the functionality.  MSIE 4 for the
   * Mac has buggy CSS support, so we let it do JavaScript, but no CSS.
   *
   * Ported from Leon's PHP code at
   * http://www.working-dogs.com/freetrade by Frank.
   *
   * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
   * @author <a href="mailto:leon@clearink.com">Leon Atkisnon</a>
   * @author <a href="mailto:mospaw@polk-county.com">Chris Mospaw</a>
   * @author <a href="mailto:bgriffin@cddb.com">Benjamin Elijah Griffin</a>
   * @version $Id: BrowserDetector.java,v 1.1 2002/02/22 18:14:31 sanders Exp $
   */
  public class BrowserDetector
  {
      protected static final String MSIE = "MSIE";
      protected static final String OPERA = "Opera";
      protected static final String MOZILLA = "Mozilla";
  
      protected static final String WINDOWS = "Windows";
      protected static final String UNIX = "Unix";
      protected static final String MACINTOSH = "Macintosh";
  
      /** The user agent string. */
      private String userAgentString = "";
  
      /** The browser name specified in the user agent string. */
      private String browserName = "";
  
      /**
       * The browser version specified in the user agent string.  If we
       * can't parse the version just assume an old browser.
       */
      private float browserVersion = (float)1.0;
  
      /**
       * The browser platform specified in the user agent string.
       */
      private String browserPlatform = "unknown";
  
      /** Whether or not javascript works in this browser. */
      private boolean javascriptOK = false;
  
      /** Whether or not CSS works in this browser. */
      private boolean cssOK = false;
  
      /** Whether or not file upload works in this browser. */
      private boolean fileUploadOK = false;
  
      /**
       * Constructor used to initialize this class.
       *
       * @param userAgentString A String with the user agent field.
       */
      public BrowserDetector(String userAgentString)
      {
          this.userAgentString = userAgentString;
          parse();
      }
  
      /**
       * Whether or not CSS works in this browser.
       *
       * @return True if CSS works in this browser.
       */
      public boolean isCssOK()
      {
          return cssOK;
      }
  
      /**
       * Whether or not file upload works in this browser.
       *
       * @return True if file upload works in this browser.
       */
      public boolean isFileUploadOK()
      {
          return fileUploadOK;
      }
  
      /**
       * Whether or not Javascript works in this browser.
       *
       * @return True if Javascript works in this browser.
       */
      public boolean isJavascriptOK()
      {
          return javascriptOK;
      }
  
      /**
       * The browser name specified in the user agent string.
       *
       * @return A String with the browser name.
       */
      public String getBrowserName()
      {
          return browserName;
      }
  
      /**
       * The browser platform specified in the user agent string.
       *
       * @return A String with the browser platform.
       */
      public String getBrowserPlatform()
      {
          return browserPlatform;
      }
  
      /**
       * The browser version specified in the user agent string.
       *
       * @return A String with the browser version.
       */
      public float getBrowserVersion()
      {
          return browserVersion;
      }
  
      /**
       * The user agent string for this class.
       *
       * @return A String with the user agent.
       */
      public String getUserAgentString()
      {
          return userAgentString;
      }
  
      /**
       * Helper method to initialize this class.
       */
      private void parse()
      {
          int versionStartIndex = userAgentString.indexOf("/");
          int versionEndIndex = userAgentString.indexOf(" ");
  
          // Get the browser name and version.
          browserName = userAgentString.substring(0, versionStartIndex);
          try
          {
              // Not all user agents will have a space in the reported
              // string.
              String agentSubstring = null;
              if (versionEndIndex < 0)
              {
                  agentSubstring =
                      userAgentString.substring(versionStartIndex + 1);
              }
              else
              {
                  agentSubstring = userAgentString.substring
                      (versionStartIndex + 1, versionEndIndex);
              }
              browserVersion = toFloat( agentSubstring );
          }
          catch (NumberFormatException e)
          {
              // Just use the default value.
          }
  
          // MSIE lies about its name.  Of course...
          if (userAgentString.indexOf(MSIE) != -1)
          {
              // Ex: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
              versionStartIndex = (userAgentString.indexOf(MSIE) +
                                   MSIE.length() + 1);
              versionEndIndex = userAgentString.indexOf(";", versionStartIndex);
  
              browserName = MSIE;
              try
              {
                  browserVersion = toFloat(userAgentString.substring
                                           (versionStartIndex, versionEndIndex));
              }
              catch (NumberFormatException e)
              {
                  // Just use the default value.
              }
  
              // PHP code
              // $Browser_Name = "MSIE";
              // $Browser_Version = strtok("MSIE");
              // $Browser_Version = strtok(" ");
              // $Browser_Version = strtok(";");
          }
  
          // Opera isn't completely honest, either...
          // Modificaton by Chris Mospaw <mo...@polk-county.com>
          if (userAgentString.indexOf(OPERA) != -1)
          {
              //Ex: Mozilla/4.0 (Windows NT 4.0;US) Opera 3.61  [en]
              versionStartIndex = (userAgentString.indexOf(OPERA) +
                                   OPERA.length() + 1);
              versionEndIndex = userAgentString.indexOf( " ",
                                                         versionStartIndex );
  
              browserName = OPERA;
              try
              {
                  browserVersion = toFloat(userAgentString.substring
                                           (versionStartIndex, versionEndIndex));
              }
              catch (NumberFormatException e)
              {
                  // Just use the default value.
              }
  
              // PHP code
              // $Browser_Name = "Opera";
              // $Browser_Version = strtok("Opera");
              // $Browser_Version = strtok("/");
              // $Browser_Version = strtok(";");
          }
  
  
          // Try to figure out what platform.
          if ( (userAgentString.indexOf("Windows") != -1) ||
               (userAgentString.indexOf("WinNT") != -1) ||
               (userAgentString.indexOf("Win98") != -1) ||
               (userAgentString.indexOf("Win95") != -1) )
          {
              browserPlatform = WINDOWS;
          }
  
          if (userAgentString.indexOf("Mac") != -1)
          {
              browserPlatform = MACINTOSH;
          }
  
          if (userAgentString.indexOf("X11") != -1)
          {
              browserPlatform =  UNIX;
          }
  
          if (browserPlatform == WINDOWS)
          {
              if (browserName.equals(MOZILLA))
              {
                  if (browserVersion >= 3.0)
                  {
                      javascriptOK = true;
                      fileUploadOK = true;
                  }
                  if (browserVersion >= 4.0)
                  {
                      cssOK = true;
                  }
              }
              else if (browserName == MSIE)
              {
                  if (browserVersion >= 4.0)
                  {
                      javascriptOK = true;
                      fileUploadOK = true;
                      cssOK = true;
                  }
              }
              else if (browserName == OPERA)
              {
                  if (browserVersion >= 3.0)
                  {
                      javascriptOK = true;
                      fileUploadOK = true;
                      cssOK = true;
                  }
              }
          }
          else if (browserPlatform == MACINTOSH)
          {
              if (browserName.equals(MOZILLA))
              {
                  if (browserVersion >= 3.0)
                  {
                      javascriptOK = true;
                      fileUploadOK = true;
                  }
                  if( browserVersion >= 4.0)
                  {
                      cssOK = true;
                  }
              }
              else if (browserName == MSIE)
              {
                  if (browserVersion >= 4.0)
                  {
                      javascriptOK = true ;
                      fileUploadOK = true;
                  }
                  if (browserVersion > 4.0)
                  {
                      cssOK = true;
                  }
              }
          }
          else if (browserPlatform ==  UNIX)
          {
              if (browserName.equals(MOZILLA))
              {
                  if (browserVersion >= 3.0)
                  {
                      javascriptOK = true;
                      fileUploadOK = true;
                  }
                  if (browserVersion >= 4.0)
                  {
                      cssOK = true;
                  }
              }
          }
      }
  
      /**
       * Helper method to conver String to a float.
       *
       * @param s A String.
       * @return The String converted to float.
       */
      private static final float toFloat(String s)
      {
          return Float.valueOf(s).floatValue();
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/http/src/java/org/apache/commons/http/HttpUtils.java
  
  Index: HttpUtils.java
  ===================================================================
  package org.apache.commons.http;
  
  /*
   * Copyright (c) 1997-2000 The Java Apache Project.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. All advertising materials mentioning features or use of this
   *    software must display the following acknowledgment:
   *    "This product includes software developed by the Java Apache
   *    Project for use in the Apache JServ servlet engine project
   *    <http://java.apache.org/>."
   *
   * 4. The names "Apache JServ", "Apache JServ Servlet Engine", "Turbine",
   *    "Apache Turbine", "Turbine Project", "Apache Turbine Project" and
   *    "Java Apache Project" must not be used to endorse or promote products
   *    derived from this software without prior written permission.
   *
   * 5. Products derived from this software may not be called "Apache JServ"
   *    nor may "Apache" nor "Apache JServ" appear in their names without
   *    prior written permission of the Java Apache Project.
   *
   * 6. Redistributions of any form whatsoever must retain the following
   *    acknowledgment:
   *    "This product includes software developed by the Java Apache
   *    Project for use in the Apache JServ servlet engine project
   *    <http://java.apache.org/>."
   *
   * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
   * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Java Apache Group. For more information
   * on the Java Apache Project and the Apache JServ Servlet Engine project,
   * please see <http://java.apache.org/>.
   *
   */
  
  import java.text.SimpleDateFormat;
  
  import java.util.Date;
  import java.util.Locale;
  import java.util.TimeZone;
  
  /**
   * This class provides utilities for handling some semi-trivial
   * HTTP stuff that would othterwize be handled elsewhere.
   *
   * @author <a href="mailto:magnus@handpoint.com">Magn�s ��r Torfason</a>
   * @version $Id: HttpUtils.java,v 1.1 2002/02/22 18:14:31 sanders Exp $
   */
  public class HttpUtils
  {
      /**
       * The date format to use for HTTP Dates.
       */
      private static SimpleDateFormat httpDateFormat;
  
      static
      {
          httpDateFormat = new SimpleDateFormat(
                  "EEE, dd MMM yyyyy HH:mm:ss z", Locale.US  );
          httpDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
      }
  
      /**
       * Formats a java Date according to rfc 1123, the rfc
       * standard for dates in http.
       *
       * @param date The Date to format
       * @return A String represeentation of the date
       */
      public static String formatHttpDate(Date date)
      {
          synchronized (httpDateFormat)
          {
              return httpDateFormat.format(date);
          }
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>