|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.rssowl.dao.ConnectionManager
public class ConnectionManager
The ConnectionManager establishes a connection to the given URL and handles Proxy and Authentification. As result, the InputStream is returned. Since the ConnectionManager will be instantiated out of parallel running Threads, it is important to check if the current executing Thread was not yet stopped.
| Field Summary | |
|---|---|
private HttpClient |
client
|
(package private) java.lang.String |
domain
|
(package private) GetMethod |
getMethod
|
private static int |
HTTP_AUTH_REQUIRED
Http Error Code: Authentication Required |
private static int |
HTTP_ERRORS
Begin of all Http Error Codes |
private java.io.InputStream |
inputStream
|
(package private) java.lang.String |
password
|
private boolean |
showLoginDialogIfRequired
|
(package private) java.lang.String |
url
|
(package private) java.lang.String |
userAgent
|
(package private) java.lang.String |
username
|
| Constructor Summary | |
|---|---|
ConnectionManager(java.lang.String url)
Instantiate a new ConnectionManager to establish a connection to the given URL |
|
| Method Summary | |
|---|---|
private void |
authenticate()
The connection requires authentification. |
void |
closeConnection()
Closes the connection |
void |
connect()
Connect to the given URL and handle Proxy and Authentification if required |
void |
connect(boolean useProxy)
Connect to the given URL and handle Proxy and Authentification if required |
java.io.InputStream |
getInputStream()
Get the resulting InputStream |
java.lang.String |
getStatusLine()
Get the statusline that the server has sent as a response to the connection |
private void |
initConnection()
Initialize the connection with creating a HttpClient object and a GET method object with the given URL |
static void |
initSSLProtocol()
This will allow to use any SSL certificate without validation. |
private void |
openConnection()
Open the connection and retrieve the InputStream from the Server. |
private void |
pipeConnection()
Try to pipe the resulting InputStream into a GZipInputStream |
private boolean |
proceed()
Checks wether the current running Thread was not yet stopped. |
private void |
setHeaders()
Set default headers to the connection |
void |
setShowLoginDialogIfRequired(boolean showLoginDialogIfRequired)
Set wether to show the LoginDialog in case authentification is required |
void |
setUserAgent(java.lang.String userAgent)
Set the user agent to use in the response header |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int HTTP_AUTH_REQUIRED
private static final int HTTP_ERRORS
private HttpClient client
private java.io.InputStream inputStream
private boolean showLoginDialogIfRequired
java.lang.String domain
GetMethod getMethod
java.lang.String password
java.lang.String url
java.lang.String userAgent
java.lang.String username
| Constructor Detail |
|---|
public ConnectionManager(java.lang.String url)
url - The URL to connect to| Method Detail |
|---|
public static void initSSLProtocol()
public void closeConnection()
public void connect()
throws HttpException,
java.io.IOException
java.io.IOException - In case an error occurs
HttpException - In case an error occurs
public void connect(boolean useProxy)
throws HttpException,
java.io.IOException
useProxy - Force usage of Proxy
java.io.IOException - In case an error occurs
HttpException - In case an error occurspublic java.io.InputStream getInputStream()
public java.lang.String getStatusLine()
public void setShowLoginDialogIfRequired(boolean showLoginDialogIfRequired)
showLoginDialogIfRequired - If TRUE, show the LoginDialog if requiredpublic void setUserAgent(java.lang.String userAgent)
userAgent - The user agent to use
private void authenticate()
throws URIException
URIException - In case the provided URL was not correct
private void initConnection()
throws java.io.IOException
java.io.IOException - In case of an error while creating the GET-Method.
private void openConnection()
throws HttpException,
java.io.IOException
java.io.IOException - If an error occurs
HttpException - If an error occurs
private void pipeConnection()
throws java.io.IOException
java.io.IOException - If an error occursprivate boolean proceed()
private void setHeaders()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||