org.apache.sling.hapi.client.impl

## Class AbstractHtmlClientImpl

- java.lang.Object
- - org.apache.sling.hapi.client.impl.AbstractHtmlClientImpl

All Implemented Interfaces:
  org.apache.http.client.HttpClient, HtmlClient

Direct Known Subclasses:
  MicrodataHtmlClient

    public abstract class AbstractHtmlClientImpl
    extends Object
    implements org.apache.http.client.HttpClient, HtmlClient

### Field Summary

Fields
`protected URI` `baseUrl`
`protected org.apache.http.impl.client.CloseableHttpClient` `client`
`protected static org.slf4j.Logger` `LOG`

### Constructor Summary

Constructors
Constructor and Description
`AbstractHtmlClientImpl(org.apache.http.impl.client.CloseableHttpClient client, String baseUrl)`
`AbstractHtmlClientImpl(String baseUrl)`
`AbstractHtmlClientImpl(String baseUrl, String user, String password)`

### Method Summary

Methods
`<T extends Document> T` `delete(String url)` Performs a DELETE request and returns a Document
`<T extends Document> T` `enter(String url)` Enters a url and return a Document
`org.apache.http.HttpResponse` `execute(org.apache.http.HttpHost httpHost, org.apache.http.HttpRequest httpRequest)`
`org.apache.http.HttpResponse` `execute(org.apache.http.HttpHost httpHost, org.apache.http.HttpRequest httpRequest, org.apache.http.protocol.HttpContext httpContext)`
`<T> T` `execute(org.apache.http.HttpHost httpHost, org.apache.http.HttpRequest httpRequest, org.apache.http.client.ResponseHandler<? extends T> responseHandler)`
`<T> T` `execute(org.apache.http.HttpHost httpHost, org.apache.http.HttpRequest httpRequest, org.apache.http.client.ResponseHandler<? extends T> responseHandler, org.apache.http.protocol.HttpContext httpContext)`
`org.apache.http.HttpResponse` `execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest)`
`org.apache.http.HttpResponse` `execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest, org.apache.http.protocol.HttpContext httpContext)`
`<T> T` `execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest, org.apache.http.client.ResponseHandler<? extends T> responseHandler)`
`<T> T` `execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest, org.apache.http.client.ResponseHandler<? extends T> responseHandler, org.apache.http.protocol.HttpContext httpContext)`
`<T extends Document> T` `get(String url)` Performs a GET request and returns a Document
`org.apache.http.conn.ClientConnectionManager` `getConnectionManager()`
`org.apache.http.params.HttpParams` `getParams()`
`abstract <T extends Document> T` `newDocument(String html)` Method to create a new Document representation from an HTML content String
`<T extends Document> T` `post(String url, org.apache.http.HttpEntity entity)` Performs a POST request.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### LOG

    protected static final org.slf4j.Logger LOG

#### client

    protected org.apache.http.impl.client.CloseableHttpClient client

#### baseUrl

    protected URI baseUrl

### Constructor Detail

#### AbstractHtmlClientImpl

    public AbstractHtmlClientImpl(org.apache.http.impl.client.CloseableHttpClient client,
                          String baseUrl)
                           throws URISyntaxException

Throws:
  `URISyntaxException`

#### AbstractHtmlClientImpl

    public AbstractHtmlClientImpl(String baseUrl)
                           throws URISyntaxException

Throws:
  `URISyntaxException`

#### AbstractHtmlClientImpl

    public AbstractHtmlClientImpl(String baseUrl,
                          String user,
                          String password)
                           throws URISyntaxException

Throws:
  `URISyntaxException`

### Method Detail

#### enter

    public <T extends Document> T enter(String url)
                             throws ClientException

Description copied from interface: `HtmlClient`
Enters a url and return a Document

Specified by:
  `enter` in interface `HtmlClient`
Returns:
Throws:
  `ClientException`

#### get

    public <T extends Document> T get(String url)
                           throws ClientException

Description copied from interface: `HtmlClient`
Performs a GET request and returns a Document

Specified by:
  `get` in interface `HtmlClient`
Parameters:
  `url` - the URL String to perform an HTTP GET on
Returns:
Throws:
  `ClientException`

#### post

    public <T extends Document> T post(String url,
                              org.apache.http.HttpEntity entity)
                            throws ClientException

Description copied from interface: `HtmlClient`
Performs a POST request.

Specified by:
  `post` in interface `HtmlClient`
Parameters:
  `url` - the URL String to perform an HTTP post on
  `entity` - data to post
Returns:
Throws:
  `ClientException`

#### delete

    public <T extends Document> T delete(String url)
                              throws ClientException

Description copied from interface: `HtmlClient`
Performs a DELETE request and returns a Document

Specified by:
  `delete` in interface `HtmlClient`
Parameters:
  `url` - the URL String to perform an HTTP DELETE on
Returns:
Throws:
  `ClientException`

#### newDocument

    public abstract <T extends Document> T newDocument(String html)

Description copied from interface: `HtmlClient`
Method to create a new Document representation from an HTML content String

Specified by:
  `newDocument` in interface `HtmlClient`
Returns:

#### getParams

    public org.apache.http.params.HttpParams getParams()

Specified by:
  `getParams` in interface `org.apache.http.client.HttpClient`

#### getConnectionManager

    public org.apache.http.conn.ClientConnectionManager getConnectionManager()

Specified by:
  `getConnectionManager` in interface `org.apache.http.client.HttpClient`

#### execute

    public org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest)
                                         throws IOException,
                                                org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`

#### execute

    public org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest,
                                       org.apache.http.protocol.HttpContext httpContext)
                                         throws IOException,
                                                org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`

#### execute

    public org.apache.http.HttpResponse execute(org.apache.http.HttpHost httpHost,
                                       org.apache.http.HttpRequest httpRequest)
                                         throws IOException,
                                                org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`

#### execute

    public org.apache.http.HttpResponse execute(org.apache.http.HttpHost httpHost,
                                       org.apache.http.HttpRequest httpRequest,
                                       org.apache.http.protocol.HttpContext httpContext)
                                         throws IOException,
                                                org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`

#### execute

    public <T> T execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest,
                org.apache.http.client.ResponseHandler<? extends T> responseHandler)
              throws IOException,
                     org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`

#### execute

    public <T> T execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest,
                org.apache.http.client.ResponseHandler<? extends T> responseHandler,
                org.apache.http.protocol.HttpContext httpContext)
              throws IOException,
                     org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`

#### execute

    public <T> T execute(org.apache.http.HttpHost httpHost,
                org.apache.http.HttpRequest httpRequest,
                org.apache.http.client.ResponseHandler<? extends T> responseHandler)
              throws IOException,
                     org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`

#### execute

    public <T> T execute(org.apache.http.HttpHost httpHost,
                org.apache.http.HttpRequest httpRequest,
                org.apache.http.client.ResponseHandler<? extends T> responseHandler,
                org.apache.http.protocol.HttpContext httpContext)
              throws IOException,
                     org.apache.http.client.ClientProtocolException

Specified by:
  `execute` in interface `org.apache.http.client.HttpClient`
Throws:
  `IOException`
  `org.apache.http.client.ClientProtocolException`