Coverage Report - org.apache.any23.http.HTTPClient
 
Classes in this File Line Coverage Branch Coverage Complexity
HTTPClient
N/A
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *  http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.any23.http;
 19  
 
 20  
 import java.io.IOException;
 21  
 import java.io.InputStream;
 22  
 
 23  
 /**
 24  
  * Abstraction for opening an {@link InputStream} on an
 25  
  * HTTP URI.
 26  
  *
 27  
  * @author Richard Cyganiak (richard@cyganiak.de)
 28  
  */
 29  
 public interface HTTPClient {
 30  
 
 31  
     /**
 32  
      * Initializes the HTTP client.
 33  
      *
 34  
      * @param configuration configuration for the HTTP Client.
 35  
      */
 36  
     public abstract void init(HTTPClientConfiguration configuration);
 37  
 
 38  
     /**
 39  
      * Opens the input stream for the given target URI.
 40  
      *
 41  
      * @param uri target URI.
 42  
      * @return input stream to access URI content.
 43  
      * @throws IOException if any error occurs while reading the URI content.
 44  
      */
 45  
     public abstract InputStream openInputStream(String uri) throws IOException;
 46  
 
 47  
     /**
 48  
      * Release all static resources help by the instance. Call this
 49  
      * method only if you are sure you will not use it again in your
 50  
      * application, like for example when shutting down a servlet
 51  
      * context.
 52  
      */
 53  
     public abstract void close();
 54  
 
 55  
     /**
 56  
      * The value of the Content-Type header reported by the server.
 57  
      * Can be <tt>null</tt>.
 58  
      *
 59  
      * @return the content type as string.
 60  
      */
 61  
     public abstract String getContentType();
 62  
 
 63  
     /**
 64  
      * @return content length in bytes.
 65  
      */
 66  
     public abstract long getContentLength();
 67  
 
 68  
     /**
 69  
      * Returns the actual URI from which the document was fetched.
 70  
      * This might differ from the URI passed to openInputStream()
 71  
      * if a redirect was performed. A return value of <tt>null</tt>
 72  
      * means that the URI is unchanged and the original URI was used.
 73  
      *
 74  
      * @return actual document URI.
 75  
      */
 76  
     public abstract String getActualDocumentURI();
 77  
     
 78  
 }