avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craft...@apache.org
Subject cvs commit: avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl HTTPClientSource.java
Date Wed, 17 Sep 2003 15:20:32 GMT
crafterm    2003/09/17 08:20:32

  Modified:    sourceresolve/src/java/org/apache/excalibur/source/impl
                        HTTPClientSource.java
  Log:
  Modified exists() implementation to check whether the named resource is readable, rather
than just existing
  
  Revision  Changes    Path
  1.9       +13 -7     avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/HTTPClientSource.java
  
  Index: HTTPClientSource.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/HTTPClientSource.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- HTTPClientSource.java	15 Sep 2003 12:28:08 -0000	1.8
  +++ HTTPClientSource.java	17 Sep 2003 15:20:32 -0000	1.9
  @@ -455,20 +455,26 @@
        * Method to update whether a referenced resource exists, after
        * executing a particular {@link HttpMethod}.
        *
  +     * <p>REVISIT: exists() would be better called canRead()
  +     * or similar, as a resource can exist but not be readable.</p>
  +     *
        * @param method {@link HttpMethod} executed.
        */
       private void updateExists( final HttpMethod method )
       {
           final int response = method.getStatusCode();
   
  -        // REVISIT(MC): should this return true if the server does 
  -        // not return a 404, or a 410, or should it only return true 
  -        // if the user can successfully get an InputStream from 
  -        // it without getting errors.
  +        // The following returns true, if the user can successfully get
  +        // an InputStream without receiving errors? ie. if we receive a
  +        // HTTP 200 (OK), 201 (CREATED), 206 (PARTIAL CONTENT)
  +
  +        // REVISIT(MC): need a special way to handle 304 (NOT MODIFIED)
  +        // 204 & 205 in the future
   
           // resource does not exist if HttpClient returns a 404 or a 410
  -        m_exists = !( response == HttpStatus.SC_GONE || 
  -                      response == HttpStatus.SC_NOT_FOUND );
  +        m_exists = (response == HttpStatus.SC_OK ||
  +                    response == HttpStatus.SC_CREATED ||
  +                    response == HttpStatus.SC_PARTIAL_CONTENT);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message