Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.any23.http
Class DefaultHTTPClient

    java.lang.Object
      org.apache.any23.http.DefaultHTTPClient

All Implemented Interfaces:
  HTTPClient

    public class DefaultHTTPClient

extends Object
implements HTTPClient

Opens an `InputStream` on an HTTP URI. Is configured with sane values for timeouts, default headers and so on.

Author:
  Paolo Capriotti, Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
`DefaultHTTPClient()`

Method Summary
`void` | `close()` Shuts down the connection manager.
`String` | `getActualDocumentURI()` Returns the actual URI from which the document was fetched.
`protected int` | `getConnectionTimeout()`
`long` | `getContentLength()`
`String` | `getContentType()` The value of the Content-Type header reported by the server.
`protected int` | `getSoTimeout()`
`void` | `init(HTTPClientConfiguration configuration)` Initializes the HTTP client.
`InputStream` | `openInputStream(String uri)` Opens an `InputStream` from a given URI.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultHTTPClient

    public DefaultHTTPClient()

Method Detail

### init

    public void init(HTTPClientConfiguration configuration)

  Description copied from interface: `HTTPClient`
  Initializes the HTTP client.

  Specified by:
    `init` in interface `HTTPClient`
  Parameters:
    `configuration` - configuration for the HTTP Client.

### openInputStream

    public InputStream openInputStream(String uri)
                                throws IOException

  Opens an `InputStream` from a given URI. It follows redirects.

  Specified by:
    `openInputStream` in interface `HTTPClient`
  Parameters:
    `uri` - to be opened
  Returns:
    `InputStream`
  Throws:
    `IOException`

### close

    public void close()

  Shuts down the connection manager.

  Specified by:
    `close` in interface `HTTPClient`

### getContentLength

    public long getContentLength()

  Specified by:
    `getContentLength` in interface `HTTPClient`
  Returns:
    content length in bytes.

### getActualDocumentURI

    public String getActualDocumentURI()

  Description copied from interface: `HTTPClient`
  Returns the actual URI from which the document was fetched. This might differ from the URI passed to openInputStream() if a redirect was performed. A return value of `null` means that the URI is unchanged and the original URI was used.

  Specified by:
    `getActualDocumentURI` in interface `HTTPClient`
  Returns:
    actual document URI.

### getContentType

    public String getContentType()

  Description copied from interface: `HTTPClient`
  The value of the Content-Type header reported by the server. Can be `null`.

  Specified by:
    `getContentType` in interface `HTTPClient`
  Returns:
    the content type as string.

### getConnectionTimeout

    protected int getConnectionTimeout()

### getSoTimeout

    protected int getSoTimeout()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.