rwaldhoff 01/08/08 10:32:52
Modified: httpclient/src/java/org/apache/commons/httpclient
HttpClient.java
Log:
Revised logging output.
Revision Changes Path
1.26 +25 -24
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
Index: HttpClient.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- HttpClient.java 2001/08/08 15:29:05 1.25
+++ HttpClient.java 2001/08/08 17:32:52 1.26
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
1.25 2001/08/08 15:29:05 rwaldhoff Exp $
- * $Revision: 1.25 $
- * $Date: 2001/08/08 15:29:05 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
1.26 2001/08/08 17:32:52 rwaldhoff Exp $
+ * $Revision: 1.26 $
+ * $Date: 2001/08/08 17:32:52 $
*
* ====================================================================
*
@@ -419,7 +419,7 @@
*/
public synchronized void executeMethod(HttpMethod method)
throws IOException, HttpException {
-
+ log.debug("HttpClient.executeMethod(HttpMethod)");
int retries = 0;
Hashtable responseHeaders = null;
@@ -430,6 +430,7 @@
openConnection();
while ((retries < 5) && (!methodProcessed)) {
+ log.debug("HttpClient.executeMethod(): trying " + retries + ".");
try {
@@ -556,7 +557,7 @@
methodProcessed = true;
} else {
if (!methodProcessed) {
-
+ log.debug("HttpClient.exectuteMethod(): Method not
processed. Recieved status code \"" + method.getStatusCode() + "\". May retry.");
if (connectionInterceptor != null) {
connectionInterceptor.retry
(method.getStatusCode());
@@ -595,14 +596,14 @@
}
openConnection();
} catch (HttpException e) {
+ log.warn("HttpClient.executeMethod(): caught HTTP Exception: " +
+ e.getMessage() + ", Status Code: " + e.getStatusCode(),e);
if (connectionInterceptor != null) {
connectionInterceptor.error(e.getStatusCode(), e);
}
// During communication, save the status code.
if (e.getStatusCode() > 0)
method.setStatusCode(e.getStatusCode());
- log.warn("HTTP Exception: " + e.getMessage() +
- ", Status Code: " + e.getStatusCode(),e);
// If something goes wrong, disconnect, then reconnect
try {
closeConnection();
@@ -671,9 +672,8 @@
* Start a session.
*/
public void startSession(String host, int port, boolean https) {
- log.debug("Start session : Host:" + host
- + " Port:" + port
- + " HTTPS:" + https);
+ log.debug("HttpClient.startSession(String,int,boolean): Host:" +
+ host + " Port:" + port + " HTTPS:" + https);
if (state == null)
state = new State();
@@ -697,10 +697,9 @@
*/
public void startSession(String host, int port, Credentials creds,
boolean https) {
- log.debug("Start session : Host:" + host
- + " Port:" + port
- + " Credentials:" + creds
- + " HTTPS:" + https);
+ log.debug("HttpClient.startSession(String,int,Credentials,boolean): Host:" +
+ host + " Port:" + port + " Credentials:" + creds +
+ " HTTPS:" + https);
setCredentials(creds);
if (state == null)
state = new State();
@@ -764,7 +763,7 @@
public void endSession()
throws IOException {
- log.debug("End session");
+ log.debug("HttpClient.endSession()");
closeConnection();
@@ -780,12 +779,12 @@
protected void openConnection() throws IOException, UnknownHostException {
-
+ log.debug("HttpClient.openConnection()");
try {
if (socket == null) {
if (proxyHost == null || proxyPort < 0) {
- log.debug("Reopen connection : Host:"
- + sessionHost + " Port:" + sessionPort);
+ log.debug("HttpClient.openConnection(): Host:" +
+ sessionHost + " Port:" + sessionPort);
if(https) {
socket = SSLSocketFactory.getDefault().createSocket
(this.sessionHost, this.sessionPort);
@@ -794,9 +793,11 @@
(this.sessionHost, this.sessionPort);
}
} else {
- log.debug("Reopen connection : Host:"
- + proxyHost + " Port:" + proxyPort);
+ log.debug("HttpClient.openConnection(): Proxied: Host:" +
+ proxyHost + " Port:" + proxyPort);
socket = new Socket(this.proxyHost, this.proxyPort);
+ // XXX FIX ME XXX ?
+ // Should allow for HTTPS via proxy ?!?
}
}
input = socket.getInputStream();
@@ -825,7 +826,7 @@
protected void closeConnection() throws IOException {
- log.debug("Closing connection");
+ log.debug("HttpClient.closeConnection()");
// Close socket
if (input != null)
@@ -1014,11 +1015,11 @@
*/
protected void parseStatusLine(String statusLine, HttpMethod method)
throws IOException, HttpException {
+ log.debug("HttpClient.parseStatusLine(String,HttpMethod)");
while (statusLine != null && !statusLine.startsWith("HTTP/")) {
statusLine = readLine(input);
}
- log.debug("Status line: " + statusLine);
if (statusLine == null)
throw new HttpException
("Error in parsing the response: " + statusLine);
@@ -1070,7 +1071,7 @@
*/
protected Hashtable parseHeaders(InputStream input)
throws IOException, HttpException {
-
+ log.debug("HttpClient.parseHeaders(InputStream)");
Hashtable result = new Hashtable();
while (true) {
@@ -1090,7 +1091,7 @@
Header header = new Header(name, value);
result.put(match, header);
- log.debug("Header line: " + name + ": " + value);
+ //log.debug("Header line: " + name + ": " + value);
}