|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.rssowl.dao.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 org.apache.commons.httpclient.HttpClient |
client
|
(package private) String |
domain
|
(package private) org.apache.commons.httpclient.methods.GetMethod |
getMethod
|
private InputStream |
inputStream
|
(package private) String |
password
|
private boolean |
showLoginDialogIfRequired
|
(package private) String |
url
|
(package private) String |
userAgent
|
(package private) String |
username
|
Constructor Summary | |
ConnectionManager(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 |
InputStream |
getInputStream()
Get the resulting InputStream |
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(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 org.apache.commons.httpclient.HttpClient client
private InputStream inputStream
private boolean showLoginDialogIfRequired
String domain
org.apache.commons.httpclient.methods.GetMethod getMethod
String password
String url
String userAgent
String username
Constructor Detail |
public ConnectionManager(String url)
url
- The URL to connect toMethod Detail |
public static void initSSLProtocol()
public void closeConnection()
public void connect() throws org.apache.commons.httpclient.HttpException, IOException
IOException
- In case an error occurs
org.apache.commons.httpclient.HttpException
- In case an error occurspublic void connect(boolean useProxy) throws org.apache.commons.httpclient.HttpException, IOException
useProxy
- Force usage of Proxy
IOException
- In case an error occurs
org.apache.commons.httpclient.HttpException
- In case an error occurspublic InputStream getInputStream()
public String getStatusLine()
public void setShowLoginDialogIfRequired(boolean showLoginDialogIfRequired)
showLoginDialogIfRequired
- If TRUE, show the LoginDialog if requiredpublic void setUserAgent(String userAgent)
userAgent
- The user agent to useprivate void authenticate() throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIException
- In case the provided URL was not correctprivate void initConnection() throws IOException
IOException
- In case of an error while creating the GET-Method.private void openConnection() throws org.apache.commons.httpclient.HttpException, IOException
IOException
- If an error occurs
org.apache.commons.httpclient.HttpException
- If an error occursprivate void pipeConnection() throws IOException
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 |