public abstract class AbstractRequester extends Object
Class which contains the logic for sending URL requests to a specified address.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRequester()
Default constructor.
|
protected |
AbstractRequester(Charset charset)
Overloaded constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Charset |
getCharset()
Getter for charset.
|
protected URLConnection |
getConnection(String url)
Retrieves the
URLConnection that represents the specified URL. |
abstract HttpResponse |
getResponse(String url)
Retrieves the response from the specified URL.
|
protected HttpResponse |
getResponse(URLConnection connection)
Retrieves the response from the specified
URLConnection. |
void |
setCharset(Charset charset)
Setter for charset.
|
protected AbstractRequester()
Default constructor. Specifies the charset to be used for requests as UTF-8.
protected AbstractRequester(Charset charset)
Overloaded constructor. Loads the request properties and other data needed for the requesters.
charset - the charset to use when doing a requestprotected URLConnection getConnection(String url) throws IOException
Retrieves the URLConnection that represents the specified URL. This
method sets the request properties for the URLConnection being
retrieved.
url - the URLURLConnectionIOException - if an exception occurred when creating the URLConnectionprotected HttpResponse getResponse(URLConnection connection) throws IOException
Retrieves the response from the specified URLConnection.
connection - the URLConnectionResponseIOException - if an exception occurred while retrieving the Responsepublic abstract HttpResponse getResponse(String url)
Retrieves the response from the specified URL.
url - the URL to callResponsepublic final Charset getCharset()
Getter for charset.
public final void setCharset(Charset charset)
Setter for charset.
charset - the charsetCopyright © 2019. All rights reserved.