You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/07/28 20:09:00 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods DeleteMethod.java GetMethod.java HeadMethod.java OptionsMethod.java PostMethod.java PutMethod.java UrlDeleteMethod.java UrlGetMethod.java UrlHeadMethod.java UrlOptionsMethod.java UrlPostMethod.java UrlPutMethod.java
jsdever 2002/07/28 11:08:59
Modified: httpclient/src/java/org/apache/commons/httpclient
Authenticator.java Base64.java ConnectMethod.java
Cookie.java Credentials.java Header.java
HeaderElement.java HttpClient.java
HttpConnection.java HttpConnectionManager.java
HttpException.java HttpMethod.java
HttpMethodBase.java HttpMultiClient.java
HttpRecoverableException.java HttpSharedState.java
HttpState.java HttpStatus.java HttpUrlMethod.java
NameValuePair.java RequestOutputStream.java
ResponseInputStream.java URIUtil.java
UsernamePasswordCredentials.java
java/org/apache/commons/httpclient/Authenticator.java
java/org/apache/commons/httpclient/Base64.java
java/org/apache/commons/httpclient/ConnectMethod.java
java/org/apache/commons/httpclient/Cookie.java
java/org/apache/commons/httpclient/Credentials.java
java/org/apache/commons/httpclient/Header.java
java/org/apache/commons/httpclient/HeaderElement.java
java/org/apache/commons/httpclient/HttpClient.java
java/org/apache/commons/httpclient/HttpConnection.java
java/org/apache/commons/httpclient/HttpConnectionManager.java
java/org/apache/commons/httpclient/HttpException.java
java/org/apache/commons/httpclient/HttpMethod.java
java/org/apache/commons/httpclient/HttpMethodBase.java
java/org/apache/commons/httpclient/HttpMultiClient.java
java/org/apache/commons/httpclient/HttpRecoverableException.java
java/org/apache/commons/httpclient/HttpSharedState.java
java/org/apache/commons/httpclient/HttpState.java
java/org/apache/commons/httpclient/HttpStatus.java
java/org/apache/commons/httpclient/HttpUrlMethod.java
java/org/apache/commons/httpclient/NameValuePair.java
java/org/apache/commons/httpclient/RequestOutputStream.java
java/org/apache/commons/httpclient/ResponseInputStream.java
java/org/apache/commons/httpclient/URIUtil.java
java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
java/org/apache/commons/httpclient/methods/DeleteMethod.java
java/org/apache/commons/httpclient/methods/GetMethod.java
java/org/apache/commons/httpclient/methods/HeadMethod.java
java/org/apache/commons/httpclient/methods/OptionsMethod.java
java/org/apache/commons/httpclient/methods/PostMethod.java
java/org/apache/commons/httpclient/methods/PutMethod.java
java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
java/org/apache/commons/httpclient/methods/UrlGetMethod.java
java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
java/org/apache/commons/httpclient/methods/UrlPostMethod.java
java/org/apache/commons/httpclient/methods/UrlPutMethod.java
httpclient/src/java/org/apache/commons/httpclient/methods
DeleteMethod.java GetMethod.java HeadMethod.java
OptionsMethod.java PostMethod.java PutMethod.java
UrlDeleteMethod.java UrlGetMethod.java
UrlHeadMethod.java UrlOptionsMethod.java
UrlPostMethod.java UrlPutMethod.java
java/org/apache/commons/httpclient/Authenticator.java
java/org/apache/commons/httpclient/Base64.java
java/org/apache/commons/httpclient/ConnectMethod.java
java/org/apache/commons/httpclient/Cookie.java
java/org/apache/commons/httpclient/Credentials.java
java/org/apache/commons/httpclient/Header.java
java/org/apache/commons/httpclient/HeaderElement.java
java/org/apache/commons/httpclient/HttpClient.java
java/org/apache/commons/httpclient/HttpConnection.java
java/org/apache/commons/httpclient/HttpConnectionManager.java
java/org/apache/commons/httpclient/HttpException.java
java/org/apache/commons/httpclient/HttpMethod.java
java/org/apache/commons/httpclient/HttpMethodBase.java
java/org/apache/commons/httpclient/HttpMultiClient.java
java/org/apache/commons/httpclient/HttpRecoverableException.java
java/org/apache/commons/httpclient/HttpSharedState.java
java/org/apache/commons/httpclient/HttpState.java
java/org/apache/commons/httpclient/HttpStatus.java
java/org/apache/commons/httpclient/HttpUrlMethod.java
java/org/apache/commons/httpclient/NameValuePair.java
java/org/apache/commons/httpclient/RequestOutputStream.java
java/org/apache/commons/httpclient/ResponseInputStream.java
java/org/apache/commons/httpclient/URIUtil.java
java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
java/org/apache/commons/httpclient/methods/DeleteMethod.java
java/org/apache/commons/httpclient/methods/GetMethod.java
java/org/apache/commons/httpclient/methods/HeadMethod.java
java/org/apache/commons/httpclient/methods/OptionsMethod.java
java/org/apache/commons/httpclient/methods/PostMethod.java
java/org/apache/commons/httpclient/methods/PutMethod.java
java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
java/org/apache/commons/httpclient/methods/UrlGetMethod.java
java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
java/org/apache/commons/httpclient/methods/UrlPostMethod.java
java/org/apache/commons/httpclient/methods/UrlPutMethod.java
Log:
For feature: http://issues.apache.org/bugzilla/show_bug.cgi?id=10804
This is a first pass, focusing on:
- Copyright notice date
- consistant construction of log objects
- trace entry logs
A few more passes and refinements will have to be made to complete the feature.
Revision Changes Path
1.23 +56 -31 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.java
Index: Authenticator.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Authenticator.java 26 Jul 2002 00:45:01 -0000 1.22
+++ Authenticator.java 28 Jul 2002 18:08:57 -0000 1.23
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -98,7 +98,7 @@
class Authenticator {
/** <tt>org.apache.commons.httpclient.Authenticator</tt> log. */
- private static final Log log = LogFactory.getLog(Authenticator.class.getName());
+ private static final Log log = LogFactory.getLog(Authenticator.class);
/** Base 64 encoder. */
private static Base64 base64 = new Base64();
@@ -149,13 +149,12 @@
* @see #authenticate(HttpMethod,HttpState,Header,String)
*/
static boolean authenticate(HttpMethod method, HttpState state)
- throws HttpException, UnsupportedOperationException {
+ throws HttpException, UnsupportedOperationException {
+ log.trace("enter Authenticator.authenticate(HttpMethod, HttpState)");
- log.debug("enter Authenticator.authenticate(HttpMethod, HttpState)");
- Header challengeHeader = method.getResponseHeader(WWW_AUTH);
-
- return authenticate(method, state, challengeHeader, WWW_AUTH_RESP);
- }
+ Header challengeHeader = method.getResponseHeader(WWW_AUTH);
+ return authenticate(method, state, challengeHeader, WWW_AUTH_RESP);
+ }
/**
* Add requisite proxy authentication credentials to the given <i>method</i>
@@ -172,13 +171,12 @@
* @see #authenticate(HttpMethod,HttpState,Header,String)
*/
static boolean authenticateProxy(HttpMethod method, HttpState state)
- throws HttpException, UnsupportedOperationException {
-
- log.debug("enter Authenticator.authenticateProxy(HttpMethod, HttpState)");
- Header challengeHeader = method.getResponseHeader(PROXY_AUTH);
+ throws HttpException, UnsupportedOperationException {
+ log.trace("enter Authenticator.authenticateProxy(HttpMethod, HttpState)");
- return authenticate(method, state, challengeHeader, PROXY_AUTH_RESP);
- }
+ Header challengeHeader = method.getResponseHeader(PROXY_AUTH);
+ return authenticate(method, state, challengeHeader, PROXY_AUTH_RESP);
+ }
/**
@@ -202,8 +200,10 @@
* @see #digest
* @see HttpMethod#addRequestHeader
*/
- private static boolean authenticate(HttpMethod method, HttpState state, Header challengeHeader, String respHeader) throws HttpException, UnsupportedOperationException {
- log.debug("enter Authenticator.authenticate(HttpMethod, HttpState, Header, String)");
+ private static boolean authenticate(HttpMethod method, HttpState state, Header challengeHeader, String respHeader)
+ throws HttpException, UnsupportedOperationException {
+
+ log.trace("enter Authenticator.authenticate(HttpMethod, HttpState, Header, String)");
//check the preemptive policy
//TODO: this needs to be a service from some configuration class
@@ -296,9 +296,10 @@
*
* @throws HttpException when no matching credentials are available
*/
- static Header basic(String realm, HttpState state, String respHeader) throws HttpException {
+ static Header basic(String realm, HttpState state, String respHeader)
+ throws HttpException {
+ log.trace("enter Authenticator.basic(String, HttpState, String)");
- log.debug("enter Authenticator.basic(String, HttpState)");
boolean proxy = PROXY_AUTH_RESP.equals(respHeader);
UsernamePasswordCredentials cred = null;
try {
@@ -320,7 +321,10 @@
* Return a Basic <tt>Authorization</tt> header value for the
* given {@link UsernamePasswordCredentials}.
*/
- static String basic(UsernamePasswordCredentials cred) throws HttpException {
+ static String basic(UsernamePasswordCredentials cred)
+ throws HttpException {
+ log.trace("enter Authenticator.basic(UsernamePasswordCredentials)");
+
String authString = cred.getUserName() + ":" + cred.getPassword();
return "Basic " + new String(base64.encode(authString.getBytes()));
}
@@ -338,8 +342,10 @@
*
* @throws HttpException when no matching credentials are available
*/
- static Header digest(String realm, HttpMethod method, HttpState state, String respHeader) throws HttpException {
- log.debug("Authenticator.digest(String,HttpState)");
+ static Header digest(String realm, HttpMethod method, HttpState state, String respHeader)
+ throws HttpException {
+ log.trace("enter Authenticator.digest(String, HttpMethod, HttpState, String)");
+
boolean proxy = PROXY_AUTH_RESP.equals(respHeader);
UsernamePasswordCredentials cred = null;
try {
@@ -377,7 +383,10 @@
* Return a Digest <tt>Authorization</tt> header value for the
* given {@link UsernamePasswordCredentials}.
*/
- static String digest(UsernamePasswordCredentials cred, Hashtable headers) throws HttpException {
+ static String digest(UsernamePasswordCredentials cred, Hashtable headers)
+ throws HttpException {
+ log.trace("enter Authenticator.digest(UsernamePasswordCredentials, Hashtable)");
+
String digest = createDigest(cred.getUserName(), cred.getPassword(), headers);
return "Digest " + createDigestHeader(cred.getUserName(), headers, digest);
}
@@ -394,8 +403,11 @@
* @return The created digest as string. This will be the response tag's
* value in the Authentication HTTP header.
*/
- public static String createDigest(String uname, String pwd, Hashtable dCreds) throws HttpException {
- String digAlg = "MD5";
+ public static String createDigest(String uname, String pwd, Hashtable dCreds)
+ throws HttpException {
+ log.trace("enter Authenticator.createDigest(String, String, Hashtable)");
+
+ final String digAlg = "MD5";
// Collecting required tokens
String uri = removeQuotes((String)dCreds.get("uri"));
@@ -437,8 +449,10 @@
* @throws AxisFault if MD5 algorithm is not supported.
*/
private static String createCnonce() throws HttpException {
+ log.trace("enter Authenticator.createCnonce()");
+
String cnonce;
- String digAlg = "MD5";
+ final String digAlg = "MD5";
MessageDigest md5Helper;
try {
md5Helper = MessageDigest.getInstance(digAlg);
@@ -460,10 +474,12 @@
* @param uname Username
* @param dCreds Hashtable containing header information (uri, realm,
* nonce, nc, cnonce, opaque, qop).
- * @digest The response tag's value as String.
+ * @param digest The response tag's value as String.
* @return The digest-response as String.
*/
private static String createDigestHeader(String uname, Hashtable dCreds, String digest) {
+ log.trace("enter Authenticator.createDigestHeader(String, Hashtable, String)");
+
StringBuffer sb = new StringBuffer();
String uri = removeQuotes((String)dCreds.get("uri"));
String realm = removeQuotes((String)dCreds.get("realm"));
@@ -502,6 +518,8 @@
* <CODE>str</CODE>
*/
private static String removeQuotes(String str) {
+ log.trace("enter Authenticator.removeQuotes(String)");
+
if (str == null)
return null;
@@ -522,6 +540,7 @@
* @return encoded MD5, or <CODE>null</CODE> if encoding failed
*/
private static String encode( byte[] binaryData ) {
+ log.trace("enter Authenticator.encode(byte[])");
if (binaryData.length != 16)
return null;
@@ -555,9 +574,13 @@
* @return The parameters from www-authenticate header as a Hashtable
*/
private static Hashtable getHTTPDigestCredentials(HttpMethod method) {
+ log.trace("enter Authenticator.getHTTPDigestCredentials(HttpMethod)");
+
String authHeader = method.getResponseHeader("www-authenticate").getValue();
Hashtable ht = new Hashtable(15);
- if (authHeader == null) return ht;
+ if (authHeader == null) {
+ return ht;
+ }
authHeader = authHeader.substring(7).trim();
int i = 0;
int j = authHeader.indexOf(",");
@@ -583,6 +606,8 @@
* entry is placed (only if it has <CODE>"xxx=yyy"</CODE> format).
*/
private static void processDigestToken(String token, Hashtable ht) {
+ log.trace("enter Authenticator.processDigestToken(String, Hashtable)");
+
int eqpos = token.indexOf("=");
if (eqpos > 0 && eqpos < token.length()-1)
1.10 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Base64.java
Index: Base64.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Base64.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Base64.java 10 Jul 2002 05:09:16 -0000 1.9
+++ Base64.java 28 Jul 2002 18:08:57 -0000 1.10
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +22 -10 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java
Index: ConnectMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConnectMethod.java 23 Jul 2002 14:38:31 -0000 1.1
+++ ConnectMethod.java 28 Jul 2002 18:08:57 -0000 1.2
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -80,6 +80,7 @@
* Create a connect method wrapping the existing method
*/
public ConnectMethod(HttpMethod method) {
+ log.trace("enter ConnectMethod(HttpMethod)");
this.method = method;
}
@@ -87,7 +88,10 @@
return NAME;
}
- public int execute(HttpState state, HttpConnection connection) throws IOException, HttpException {
+ public int execute(HttpState state, HttpConnection connection)
+ throws IOException, HttpException {
+
+ log.trace("enter ConnectMethod.execute(HttpState, HttpConnection)");
int code = super.execute(state, connection);
log.debug("CONNECT status code "+ code);
if ((code >= 200) && (code < 300)) {
@@ -100,7 +104,10 @@
/**
* Writes a minimal set of headers to the proxy.
*/
- protected void writeRequestHeaders(HttpState state, HttpConnection conn) throws HttpException, IOException {
+ protected void writeRequestHeaders(HttpState state, HttpConnection conn)
+ throws HttpException, IOException {
+ log.trace("enter ConnectMethod.writeRequestHeaders(HttpState, HttpConnection)");
+
if (method instanceof HttpMethodBase) {
((HttpMethodBase) method).addRequestHeaders(state, conn);
}
@@ -122,8 +129,13 @@
conn.printLine(line);
}
- /** the log for output */
- static private final Log log = LogFactory.getLog(ConnectMethod.class);
+
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(ConnectMethod.class);
+
+ /** Log for any wire messages. */
+ private static final Log wireLog = LogFactory.getLog("httpclient.wirelog");
+
/** The wrapped method */
private HttpMethod method;
-}
\ No newline at end of file
+}
1.21 +40 -16 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java
Index: Cookie.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Cookie.java 21 Jul 2002 04:12:44 -0000 1.20
+++ Cookie.java 28 Jul 2002 18:08:57 -0000 1.21
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -123,6 +123,7 @@
*/
public Cookie(String domain, String name, String value, String path, Date expires, boolean secure) {
super(name, value);
+ log.trace("enter Cookie(String, String, String, String, Date, boolean)");
this.setPath(path);
this.setDomain(domain);
this.setExpiryDate(expires);
@@ -408,6 +409,7 @@
* Two cookies are equal if the name, path and domain match.
*/
public boolean equals(Object obj) {
+ log.trace("enter Cookie.equals(Object)");
if ((obj != null) && (obj instanceof Cookie)) {
Cookie that = (Cookie) obj;
return (null == this.getName() ? null == that.getName() : this.getName().equals(that.getName())) &&
@@ -447,6 +449,7 @@
* @param date the time at which the request is submitted
*/
public boolean matches(String domain, int port, String path, boolean secure, Date now) {
+ log.trace("enter Cookie.matches(Strinng, int, String, boolean, Date");
// FIXME: RFC2109 doesn't consider ports when filtering/matching
// cookies. Quoting from Section 2 - Terminology:
// The terms request-host and request-URI refer to
@@ -484,7 +487,8 @@
* @param path the path to which the request is being submitted
*/
public boolean matches(String domain, int port, String path, boolean secure) {
- return matches(domain,port,path,secure,new Date());
+ log.trace("enter Cookie.matches(String, int, String, boolean");
+ return matches(domain, port, path, secure, new Date());
}
/**
@@ -497,6 +501,7 @@
* If no cookies match, returns null.
*/
public static Header createCookieHeader(String domain, String path, Cookie[] cookies) {
+ log.trace("enter Cookie.createCookieHeader(String, String, Cookie[])");
return Cookie.createCookieHeader(domain,path,false,cookies);
}
@@ -510,7 +515,10 @@
* @exception java.lang.IllegalArgumentException if domain or path is null
* @deprecated use the version which includes port number and date
*/
- public static Header createCookieHeader(String domain, String path, boolean secure, Cookie[] cookies) throws IllegalArgumentException {
+ public static Header createCookieHeader(String domain, String path, boolean secure, Cookie[] cookies)
+ throws IllegalArgumentException {
+ log.trace("enter Cookie.createCookieHeader(String, String, boolean, Cookie[])");
+
// Make sure domain isn't null here. Path will be validated in subsequent call to createCookieHeader
if(domain == null){
throw new IllegalArgumentException("null domain in createCookieHeader.");
@@ -538,8 +546,10 @@
* If no cookies match, returns null.
* @exception java.lang.IllegalArgumentException if domain or path is null
*/
- public static Header createCookieHeader(String domain, int port, String path, boolean secure, Cookie[] cookies) throws IllegalArgumentException {
- return Cookie.createCookieHeader(domain,port,path,secure,new Date(),cookies);
+ public static Header createCookieHeader(String domain, int port, String path, boolean secure, Cookie[] cookies)
+ throws IllegalArgumentException {
+ log.trace("enter Cookie.createCookieHeader(String, int, String, bookean, Cookie[])");
+ return Cookie.createCookieHeader(domain, port, path, secure, new Date(), cookies);
}
/**
@@ -552,7 +562,10 @@
* If no cookies match, returns null.
* @exception java.lang.IllegalArgumentException if domain or path is null
*/
- public static Header createCookieHeader(String domain, int port, String path, boolean secure, Date now, Cookie[] cookies) throws IllegalArgumentException {
+ public static Header createCookieHeader(String domain, int port, String path, boolean secure, Date now, Cookie[] cookies)
+ throws IllegalArgumentException {
+ log.trace("enter Cookie.createCookieHeader(String, int, String, bookean, Date, Cookie[])");
+
// Validate the domain and path
if(domain == null){
throw new IllegalArgumentException("null domain in createCookieHeader.");
@@ -604,6 +617,8 @@
* of RFC2109</p>
*/
public int compare(Object o1, Object o2) {
+ log.trace("enter Cookie.compare(Object, Object)");
+
if (!(o1 instanceof Cookie)) {
throw new ClassCastException(o1.getClass().getName());
}
@@ -654,7 +669,9 @@
* @throws HttpException if an exception occurs during parsing
* @throws java.lang.IllegalArgumentException if domain or path are null
*/
- public static Cookie[] parse(String domain, int port, String path, Header setCookie) throws HttpException, IllegalArgumentException {
+ public static Cookie[] parse(String domain, int port, String path, Header setCookie)
+ throws HttpException, IllegalArgumentException {
+ log.trace("enter Cookie.parse(String, int, String, Header)");
return Cookie.parse(domain,port,path,false,setCookie);
}
@@ -670,7 +687,9 @@
* @throws HttpException if an exception occurs during parsing
* @throws java.lang.IllegalArgumentException if domain or path are null
*/
- public static Cookie[] parse(String domain, String path, Header setCookie) throws HttpException, IllegalArgumentException {
+ public static Cookie[] parse(String domain, String path, Header setCookie)
+ throws HttpException, IllegalArgumentException {
+ log.trace("enter Cookie.parse(String, String, Header)");
return Cookie.parse(domain,80,path,false,setCookie);
}
@@ -686,7 +705,9 @@
* @throws HttpException if an exception occurs during parsing
* @throws java.lang.IllegalArgumentException if domain or path are null
*/
- public static Cookie[] parse(String domain, String path, boolean secure, Header setCookie) throws HttpException {
+ public static Cookie[] parse(String domain, String path, boolean secure, Header setCookie)
+ throws HttpException {
+ log.trace("enter Cookie.parse(String, String, boolean, Header)");
return Cookie.parse(domain,(secure ? 443 : 80),path,secure,setCookie);
}
@@ -718,7 +739,10 @@
* @throws HttpException if an exception occurs during parsing
* @throws java.lang.IllegalArgumentException if domain or path are null
*/
- public static Cookie[] parse(String domain, int port, String path, boolean secure, Header setCookie) throws HttpException, IllegalArgumentException {
+ public static Cookie[] parse(String domain, int port, String path, boolean secure, Header setCookie)
+ throws HttpException, IllegalArgumentException {
+ log.trace("enter Cookie.parse(String, int, String, boolean, Header)");
+
// Validate domain and path
if(domain == null){
throw new IllegalArgumentException("domain may not be null.");
@@ -1090,8 +1114,8 @@
Locale.US);
}
- /** <tt>org.apache.commons.httpclient.Cookie</tt> log. */
- private static final Log log = LogFactory.getLog(Cookie.class.getName());
+ /** Log object for this class */
+ private static final Log log = LogFactory.getLog(Cookie.class);
}
1.5 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Credentials.java
Index: Credentials.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Credentials.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Credentials.java 5 Jan 2002 11:15:59 -0000 1.4
+++ Credentials.java 28 Jul 2002 18:08:57 -0000 1.5
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.8 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Header.java
Index: Header.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Header.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Header.java 14 Jul 2002 02:31:39 -0000 1.7
+++ Header.java 28 Jul 2002 18:08:57 -0000 1.8
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.10 +15 -11 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HeaderElement.java
Index: HeaderElement.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HeaderElement.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- HeaderElement.java 21 Jul 2002 04:12:44 -0000 1.9
+++ HeaderElement.java 28 Jul 2002 18:08:57 -0000 1.10
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -149,8 +149,8 @@
// -------------------------------------------------------- Constants
- /** <tt>org.apache.commons.httpclient.HeaderElement</tt> log. */
- static private final Log log = LogFactory.getLog(HeaderElement.class.getName());
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(HeaderElement.class);
/**
* Map of numeric values to whether or not the
@@ -254,8 +254,9 @@
* @throws HttpException if the above syntax rules are violated.
*/
public final static HeaderElement[] parse(String headerValue)
- throws HttpException
- {
+ throws HttpException {
+ log.trace("enter HeaderElement.parse(String)");
+
if (headerValue == null) {
return null;
}
@@ -371,6 +372,8 @@
* otherwise
*/
private final static boolean hasOddNumberOfQuotationMarks(String string) {
+ log.trace("enter HeaderElement.hasOddNumberOfQuotationMarks(String)");
+
boolean odd = false;
int start = -1;
while ((start = string.indexOf('"', start+1)) != -1) {
@@ -387,14 +390,15 @@
* @param end the end position of the text within the array
* @return a {@link NameValuePair} representing the header
*/
- private final static NameValuePair parsePair(char[] header, int start,
- int end) {
+ private final static NameValuePair parsePair(char[] header, int start, int end) {
+ log.trace("enter HeaderElement.parsePair(char[], int, int)");
boolean done = false;
NameValuePair pair = null;
String name = new String(header, start, end - start).trim();
String value = null;
+ //TODO: This would certainly benefit from a StringBuffer
int index = name.indexOf("=");
if (index >= 0) {
if ((index + 1) < name.length()) {
1.53 +38 -30 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.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- HttpClient.java 23 Jul 2002 14:38:31 -0000 1.52
+++ HttpClient.java 28 Jul 2002 18:08:57 -0000 1.53
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -89,7 +89,7 @@
// -------------------------------------------------------------- Constants
- /** <tt>org.apache.commons.httpclient.HttpClient</tt> log. */
+ /** Log object for this class. */
private static final Log log = LogFactory.getLog(HttpClient.class);
// ----------------------------------------------------------- Constructors
@@ -169,6 +169,7 @@
* @see #endSession()
*/
public void startSession(String host, int port) {
+ log.trace("enter HttpClient.startSession(String, int)");
startSession(host, port, false);
}
@@ -183,6 +184,8 @@
*
*/
public void startSession(String host, int port, boolean https) {
+ log.trace("enter HttpClient.startSession(String, int, boolean)");
+
if (log.isDebugEnabled()) {
log.debug("HttpClient.startSession(String,int,boolean): Host:"
+ host + " Port:" + port + " HTTPS:" + https);
@@ -201,6 +204,7 @@
* @see #endSession()
*/
public void startSession(String host, int port, Credentials creds) {
+ log.trace("enter HttpClient.startSession(String, int, Credentials)");
startSession(host, port, creds, false);
}
@@ -216,12 +220,14 @@
* @param https when <code>true</code>, create an HTTPS session
* @see #endSession()
*/
- public void startSession(String host, int port, Credentials creds,
- boolean https) {
+ public void startSession(String host, int port, Credentials creds, boolean https) {
+ log.trace("enter HttpClient.startSession(String, int, Credentials, boolean)");
+
if (log.isDebugEnabled()) {
log.debug(
- "HttpClient.startSession(String,int,Credentials,boolean): Host:"
- + host + " Port:" + port + " Credentials:" + creds
+ "Starting HttpClient session"
+ + " Host:" + host
+ + " Port:" + port + " Credentials:" + creds
+ " HTTPS:" + https);
}
getState().setCredentials(null, creds);
@@ -243,16 +249,18 @@
*
*/
public void startSession(URL url) {
- if ("https".equalsIgnoreCase(url.getProtocol())) {
- startSession(url.getHost(), url.getPort() == -1 ? 443
- : url.getPort(), true);
- } else if ("http".equalsIgnoreCase(url.getProtocol())) {
- startSession(url.getHost(), url.getPort() == -1 ? 80
- : url.getPort(), false);
- } else {
- throw new IllegalArgumentException("Protocol " + url.getProtocol()
- + " not supported in URL " + url);
- }
+ log.trace("enter HttpClient.startSession(String, int, Credentials, boolean)");
+
+ if ("https".equalsIgnoreCase(url.getProtocol())) {
+ startSession(url.getHost(), url.getPort() == -1 ? 443
+ : url.getPort(), true);
+ } else if ("http".equalsIgnoreCase(url.getProtocol())) {
+ startSession(url.getHost(), url.getPort() == -1 ? 80
+ : url.getPort(), false);
+ } else {
+ throw new IllegalArgumentException("Protocol " + url.getProtocol()
+ + " not supported in URL " + url);
+ }
}
/**
@@ -271,6 +279,7 @@
*
*/
public void startSession(URL url, Credentials creds) {
+ log.trace("enter HttpClient.startSession(URL, Credentials)");
getState().setCredentials(null, creds);
startSession(url);
}
@@ -287,8 +296,8 @@
* @see #endSession()
*
*/
- public void startSession(String host, int port,
- String proxyhost, int proxyport) {
+ public void startSession(String host, int port, String proxyhost, int proxyport) {
+ log.trace("enter HttpClient.startSession(String, int, String, int)");
startSession(host, port, proxyhost, proxyport, false);
}
@@ -306,11 +315,9 @@
* @see #endSession()
*
*/
- public void startSession(String host, int port,
- String proxyhost, int proxyport,
- boolean secure) {
- connection = new HttpConnection(proxyhost, proxyport, host, port,
- secure);
+ public void startSession(String host, int port, String proxyhost, int proxyport, boolean secure) {
+ log.trace("enter HttpClient.startSession(String, int, String, int, boolean)");
+ connection = new HttpConnection(proxyhost, proxyport, host, port, secure);
}
/**
@@ -324,8 +331,9 @@
* @throws HttpException if a protocol exception occurs
* @throws IllegalStateException if the session has not been started
*/
- public synchronized int executeMethod(HttpMethod method) throws IOException,
- HttpException, IllegalStateException {
+ public synchronized int executeMethod(HttpMethod method)
+ throws IOException, HttpException, IllegalStateException {
+ log.trace("enter HttpClient.executeMethod(HttpMethod)");
if (null == method) {
throw new NullPointerException("HttpMethod parameter");
@@ -361,7 +369,7 @@
* @throws IOException when i/o errors occur closing the connection
*/
public void endSession() throws IOException {
- log.debug("HttpClient.endSession()");
+ log.trace("enter HttpClient.endSession()");
if (null != connection) {
connection.close();
connection = null;
1.13 +82 -68 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
Index: HttpConnection.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpConnection.java 23 Jul 2002 14:38:31 -0000 1.12
+++ HttpConnection.java 28 Jul 2002 18:08:57 -0000 1.13
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -302,8 +302,8 @@
* protocol, such as a TCP error.
* @throws IllegalStateException if I am not connected
*/
- public void setSoTimeout(int timeout) throws SocketException,
- IllegalStateException {
+ public void setSoTimeout(int timeout)
+ throws SocketException, IllegalStateException {
log.debug("HttpConnection.setSoTimeout("+ timeout +")");
_so_timeout = timeout;
if(_socket != null){
@@ -318,7 +318,8 @@
* @throws IOException when there are errors opening the connection
*/
public void open() throws IOException {
- log.debug("HttpConnection.open()");
+ log.trace("enter HttpConnection.open()");
+
assertNotOpen(); // ??? is this worth doing?
try {
if (null == _socket) {
@@ -358,8 +359,14 @@
* @throws IOException if an error occured creating the secure socket
*/
public void tunnelCreated() throws IllegalStateException, IOException {
- if (!isSecure() || !isProxied()) throw new IllegalStateException("Connection must be secure and proxied to use this feature");
- if (_usingSecureSocket) throw new IllegalStateException("Already using a secure socket");
+ log.trace("enter HttpConnection.tunnelCreated()");
+
+ if (!isSecure() || !isProxied()) {
+ throw new IllegalStateException("Connection must be secure and proxied to use this feature");
+ }
+ if (_usingSecureSocket) {
+ throw new IllegalStateException("Already using a secure socket");
+ }
if (sslSocketFactory == null) {
sslSocketFactory = SSLSocketFactory.getDefault();
@@ -392,9 +399,9 @@
* @return a stream to write the request to
*/
public OutputStream getRequestOutputStream() throws IOException, IllegalStateException {
+ log.trace("enter HttpConnection.getRequestOutputStream()");
assertOpen();
- RequestOutputStream out = new RequestOutputStream(_output);
- return out;
+ return new RequestOutputStream(_output);
}
/**
@@ -407,10 +414,12 @@
* @throws IOException if an I/O problem occurs
* @return a stream to write the request to
*/
- public OutputStream getRequestOutputStream(boolean useChunking) throws IOException, IllegalStateException {
+ public OutputStream getRequestOutputStream(boolean useChunking)
+ throws IOException, IllegalStateException {
+ log.trace("enter HttpConnection.getRequestOutputStream(boolean)");
+
assertOpen();
- RequestOutputStream out = new RequestOutputStream(_output,useChunking);
- return out;
+ return new RequestOutputStream(_output, useChunking);
}
/**
@@ -429,6 +438,7 @@
*/
public InputStream getResponseInputStream(HttpMethod method)
throws IOException, IllegalStateException {
+ log.trace("enter HttpConnection.getRequestOutputStream(HttpMethod)");
assertOpen();
return new ResponseInputStream(_input,method);
}
@@ -442,27 +452,22 @@
* @throws IllegalStateException if I am not connected
* @throws IOException if an I/O problem occurs
*/
- public void write(byte[] data) throws IOException, IllegalStateException,
- HttpRecoverableException {
- if(log.isDebugEnabled()){
- log.debug("HttpConnection.write(byte[])");
- }
+ public void write(byte[] data)
+ throws IOException, IllegalStateException, HttpRecoverableException {
+ log.trace("enter HttpConnection.write(byte[])");
+
assertOpen();
if(wireLog.isInfoEnabled() && (data.length > 0)) {
wireLog.info(">> \"" + new String(data) + "\"");
}
try {
_output.write(data);
- } catch(SocketException e){
- if(log.isDebugEnabled()) {
- log.debug("HttpConnection: Socket exception while writing data",e);
- }
- throw new HttpRecoverableException(e.toString());
- } catch(IOException e) {
- if(log.isDebugEnabled()) {
- log.debug("HttpConnection: Exception while writing data",e);
- }
- throw e;
+ } catch(SocketException se){
+ log.debug("HttpConnection: Socket exception while writing data", se);
+ throw new HttpRecoverableException(se.toString());
+ } catch(IOException ioe) {
+ log.debug("HttpConnection: Exception while writing data", ioe);
+ throw ioe;
}
}
@@ -477,6 +482,7 @@
* @param len the number of bytes to write.
*/
public void write(byte[] data, int off, int len) throws IOException {
+ log.trace("enter HttpConnection.write(byte[], int, int)");
_output.write(data, off, len);
}
@@ -485,16 +491,14 @@
* output stream.
*
* @param data the bytes to be written
- * @throws HttpRecoverableException when socket exceptions occur writing
- * data
+ * @throws HttpRecoverableException when socket exceptions occur writing data
* @throws IllegalStateException if I am not connected
* @throws IOException if an I/O problem occurs
*/
- public void writeLine(byte[] data) throws IOException,
- IllegalStateException, HttpRecoverableException {
- if(log.isDebugEnabled()){
- log.debug("HttpConnection.writeLine(byte[])");
- }
+ public void writeLine(byte[] data)
+ throws IOException, IllegalStateException, HttpRecoverableException {
+ log.trace("enter HttpConnection.writeLine(byte[])");
+
assertOpen();
if(wireLog.isInfoEnabled() && (data.length > 0)) {
wireLog.info(">> \"" + new String(data) + "\"");
@@ -520,21 +524,19 @@
* @throws IllegalStateException if I am not connected
* @throws IOException if an I/O problem occurs
*/
- public void writeLine() throws IOException, IllegalStateException,
- HttpRecoverableException {
- if(log.isDebugEnabled()){
- log.debug("HttpConnection.writeLine()");
- }
+ public void writeLine()
+ throws IOException, IllegalStateException, HttpRecoverableException {
+ log.trace("enter HttpConnection.writeLine()");
+
wireLog.info(">> \\r\\n");
try{
_output.write(CRLF);
- } catch(SocketException e){
- if(log.isDebugEnabled()) {
- log.debug("HttpConnection: Socket exception while writing data",e);
- }
- throw new HttpRecoverableException(e.toString());
- } catch(IOException e){
- throw e;
+ } catch(SocketException se){
+ log.warn("HttpConnection: Socket exception while writing data", se);
+ throw new HttpRecoverableException(se.toString());
+ } catch(IOException ioe){
+ log.warn("HttpConnection: IO exception while writing data", ioe);
+ throw ioe;
}
}
@@ -547,8 +549,9 @@
* @throws IllegalStateException if I am not connected
* @throws IOException if an I/O problem occurs
*/
- public void print(String data) throws IOException, IllegalStateException,
- HttpRecoverableException {
+ public void print(String data)
+ throws IOException, IllegalStateException, HttpRecoverableException {
+ log.trace("enter HttpConnection.print(String)");
write(data.getBytes());
}
@@ -562,8 +565,9 @@
* @throws IllegalStateException if I am not connected
* @throws IOException if an I/O problem occurs
*/
- public void printLine(String data) throws IOException,
- IllegalStateException, HttpRecoverableException {
+ public void printLine(String data)
+ throws IOException, IllegalStateException, HttpRecoverableException {
+ log.trace("enter HttpConnection.printLine(String)");
writeLine(data.getBytes());
}
@@ -577,6 +581,7 @@
*/
public void printLine() throws IOException, IllegalStateException,
HttpRecoverableException {
+ log.trace("enter HttpConnection.printLine()");
writeLine();
}
@@ -587,8 +592,10 @@
* @throws IOException if an I/O problem occurs
* @return a line from the response
*/
- public String readLine() throws IOException, IllegalStateException {
- log.debug("HttpConnection.readLine()");
+ public String readLine()
+ throws IOException, IllegalStateException {
+ log.trace("enter HttpConnection.readLine()");
+
assertOpen();
StringBuffer buf = new StringBuffer();
for(;;) {
@@ -618,7 +625,8 @@
* Shutdown my {@link Socket}'s output, via {@link Socket#shutdownOutput}.
*/
public void shutdownOutput() {
- log.debug("HttpConnection.shutdownOutput()");
+ log.trace("enter HttpConnection.shutdownOutput()");
+
try {
// Socket.shutdownOutput is a JDK 1.3
// method. We'll use reflection in case
@@ -628,7 +636,8 @@
("shutdownOutput", paramsClasses);
Object[] params = new Object[0];
shutdownOutput.invoke(_socket, params);
- } catch (Exception e) {
+ } catch (Exception ex) {
+ log.debug("Unexpected Exception caught", ex);
// Ignore, and hope everything goes right
}
// close output stream?
@@ -638,7 +647,7 @@
* Close my socket and streams.
*/
public void close() {
- log.debug("HttpConnection.close()");
+ log.trace("enter HttpConnection.close()");
closeSocketAndStreams();
}
@@ -649,24 +658,27 @@
* Close everything out.
*/
protected void closeSocketAndStreams() {
- log.debug("HttpConnection.closeSocketAndStreams()");
+ log.trace("enter HttpConnection.closeSockedAndStreams()");
try {
_input.close();
- } catch(Exception e) {
+ } catch(Exception ex) {
+ log.debug("Exception caught when closing input", ex);
// ignored
}
_input = null;
try {
_output.close();
- } catch(Exception e) {
+ } catch(Exception ex) {
+ log.debug("Exception caught when closing output", ex);
// ignored
}
_output = null;
try {
_socket.close();
- } catch(Exception e) {
+ } catch(Exception ex) {
+ log.debug("Exception caught when closing socket", ex);
// ignored
}
_socket = null;
@@ -680,7 +692,8 @@
*
* @throws IllegalStateException if connected
*/
- protected void assertNotOpen() throws IllegalStateException {
+ protected void assertNotOpen()
+ throws IllegalStateException {
if(_open) {
throw new IllegalStateException("Connection is open");
}
@@ -691,7 +704,8 @@
*
* @throws IllegalStateException if not connected
*/
- protected void assertOpen() throws IllegalStateException {
+ protected void assertOpen()
+ throws IllegalStateException {
if(!_open) {
throw new IllegalStateException("Connection is not open");
}
@@ -699,10 +713,10 @@
// ------------------------------------------------------------- Attributes
- /** <tt>org.apache.commons.httpclient.HttpConnection</tt> log. */
- static private final Log log = LogFactory.getLog(HttpConnection.class.getName());
- /** <tt>httpclient.wire</tt> log. */
- static private final Log wireLog = LogFactory.getLog("httpclient.wire");
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(HttpConnection.class);
+ /** Log for any wire messages. */
+ private static final Log wireLog = LogFactory.getLog("httpclient.wire");
/** My host. */
private String _host = null;
/** My port. */
1.9 +34 -31 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnectionManager.java
Index: HttpConnectionManager.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnectionManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HttpConnectionManager.java 23 Jul 2002 14:38:31 -0000 1.8
+++ HttpConnectionManager.java 28 Jul 2002 18:08:57 -0000 1.9
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -79,8 +79,8 @@
public class HttpConnectionManager
{
// -------------------------------------------------------- Class Variables
- private static final Log log = LogFactory.getLog(
- HttpConnectionManager.class);
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(HttpConnectionManager.class);
// ----------------------------------------------------- Instance Variables
private HashMap mapHosts = new HashMap();
@@ -92,8 +92,7 @@
/**
* No-args constructor
*/
- public HttpConnectionManager()
- {
+ public HttpConnectionManager() {
}
/**
@@ -101,8 +100,7 @@
*
* @param proxyHost - the proxy host name
*/
- public void setProxyHost(String proxyHost)
- {
+ public void setProxyHost(String proxyHost) {
this.proxyHost = proxyHost;
}
@@ -111,8 +109,7 @@
*
* @return the proxy host name
*/
- public String getProxyHost()
- {
+ public String getProxyHost() {
return proxyHost;
}
@@ -121,8 +118,7 @@
*
* @param proxyPort - the proxy port number
*/
- public void setProxyPort(int proxyPort)
- {
+ public void setProxyPort(int proxyPort) {
this.proxyPort = proxyPort;
}
@@ -131,8 +127,7 @@
*
* @return the proxy port number
*/
- public int getProxyPort()
- {
+ public int getProxyPort() {
return proxyPort;
}
@@ -142,8 +137,7 @@
*
* @param maxConnections - number of connections allowed for each host:port
*/
- public void setMaxConnectionsPerHost(int maxConnections)
- {
+ public void setMaxConnectionsPerHost(int maxConnections) {
this.maxConnections = maxConnections;
}
@@ -152,8 +146,7 @@
*
* @return The maximum number of connections allowed for a given host:port.
*/
- public int getMaxConnectionsPerHost()
- {
+ public int getMaxConnectionsPerHost() {
return maxConnections;
}
@@ -168,9 +161,8 @@
* @exception java.net.MalformedURLException
* @exception org.apache.commons.HttpException - If no connection becomes availble before the timeout expires
*/
- public HttpConnection getConnection(String sURL) throws HttpException,
- MalformedURLException
- {
+ public HttpConnection getConnection(String sURL)
+ throws HttpException, MalformedURLException {
return getConnection(sURL, 0);
}
@@ -186,6 +178,8 @@
* @return the port for the specified port and protocol.
*/
private static int getPort(String protocol, int port) {
+ log.trace("HttpConnectionManager.getPort(String, port)");
+
// default to provided port
int portForProtocol = port;
if (portForProtocol == -1) {
@@ -215,8 +209,9 @@
* availble before the timeout expires
*/
public HttpConnection getConnection(String sURL, long timeout)
- throws HttpException, MalformedURLException
- {
+ throws HttpException, MalformedURLException {
+ log.trace("enter HttpConnectionManager.getConnection(String, long)");
+
// FIXME: This method is too big
if (sURL == null) {
throw new MalformedURLException("URL is null");
@@ -269,6 +264,8 @@
* @return a pool (list) of connections available for the given key
*/
private LinkedList getConnections(String hostAndPort) {
+ log.trace("enter HttpConnectionManager.getConnections(String)");
+
// Look for a list of connections for the given host:port
LinkedList listConnections = null;
synchronized (mapHosts) {
@@ -290,8 +287,10 @@
* @return the number of connections in use for the given key
*/
public Integer getConnectionsInUse(String hostAndPort) {
+ log.trace("enter HttpConnectionManager.getConnectionsInUse(String)");
// FIXME: Shouldn't this be synchronized on mapNumConnections? or
// mapHosts?
+
Integer numConnections = (Integer)mapNumConnections.get(hostAndPort);
if (numConnections == null) {
log.error("HttpConnectionManager.getConnection: "
@@ -308,6 +307,8 @@
*/
private HttpConnection waitForConnection(LinkedList pool, long timeout)
throws HttpException {
+ log.trace("enter HttpConnectionManager.waitForConnection(LinkedList, long)");
+
// No connections available, so wait
// Start the timeout thread
TimeoutThread threadTimeout = new TimeoutThread();
@@ -340,8 +341,9 @@
*
* @param conn - The HttpConnection to make available.
*/
- public void releaseConnection(HttpConnection conn)
- {
+ public void releaseConnection(HttpConnection conn) {
+ log.trace("enter HttpConnectionManager.releaseConnection(HttpConnection)");
+
String host = conn.getHost();
int port = conn.getPort();
String key = host + ":" + port;
@@ -377,8 +379,8 @@
* an outside mechanism to interrupt the waiting thread after the specified
* timeout interval.
*/
- private static class TimeoutThread extends Thread
- {
+ private static class TimeoutThread extends Thread {
+
private long timeout = 0;
private Thread thrdWakeup = null;
@@ -402,8 +404,8 @@
return thrdWakeup;
}
- public void run()
- {
+ public void run() {
+ log.trace("TimeoutThread.run()");
if(timeout == 0){
return;
}
@@ -415,6 +417,7 @@
sleep(timeout);
thrdWakeup.interrupt();
}catch(InterruptedException e){
+ log.debug("InterruptedException caught as expected");
// This is expected
}
}
1.6 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java
Index: HttpException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HttpException.java 5 Jan 2002 11:16:00 -0000 1.5
+++ HttpException.java 28 Jul 2002 18:08:57 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.14 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java
Index: HttpMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HttpMethod.java 21 Jul 2002 04:12:45 -0000 1.13
+++ HttpMethod.java 28 Jul 2002 18:08:57 -0000 1.14
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.38 +94 -61 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
Index: HttpMethodBase.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- HttpMethodBase.java 28 Jul 2002 06:24:51 -0000 1.37
+++ HttpMethodBase.java 28 Jul 2002 18:08:57 -0000 1.38
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -170,8 +170,7 @@
* NOTE: StrictMode is currently experimental and its functionlaity may change in the future.
*
*/
- public void setStrictMode(boolean strictMode)
- {
+ public void setStrictMode(boolean strictMode) {
this.strictMode = strictMode;
}
@@ -182,8 +181,7 @@
*
* @return true if strict mode is enabled.
*/
- public boolean isStrictMode()
- {
+ public boolean isStrictMode() {
return strictMode;
}
@@ -249,7 +247,7 @@
// semantics of the message, by appending each subsequent field-value
// to the first, each separated by a comma."
// - HTTP/1.0 (4.3)
- log.debug("HttpMethodBase.addRequestHeader(Header)");
+ log.trace("HttpMethodBase.addRequestHeader(Header)");
if (header == null){
log.debug("null header value ignored");
@@ -316,6 +314,8 @@
* to add as query string parameterss
*/
public void setQueryString(NameValuePair[] params) {
+ log.trace("enter HttpMethodBase.setQueryString(NameValuePair[])");
+
StringBuffer buf = new StringBuffer();
boolean needAmp = false;
for(int i=0;i<params.length;i++) {
@@ -439,11 +439,10 @@
*
* @return the integer status code if one was obtained, or <tt>-1</tt>
*/
- public int execute(HttpState state, HttpConnection connection) throws HttpException, IOException {
+ public int execute(HttpState state, HttpConnection connection)
+ throws HttpException, IOException {
// FIXME: This method is too large
- if (log.isDebugEnabled()) {
- log.debug("enter HttpMethodBase.execute(HttpState, HttpConnection)");
- }
+ log.trace("enter HttpMethodBase.execute(HttpState, HttpConnection)");
if (null == state) {
throw new NullPointerException("HttpState parameter");
@@ -747,10 +746,10 @@
* @param state the client state
* @param conn the {@link HttpConnection} to write the request to
*/
- protected void writeRequest(HttpState state, HttpConnection conn) throws IOException, HttpException {
- if (log.isDebugEnabled()) {
- log.debug("HttpMethodBase.writeRequest(HttpState,HttpConnection)");
- }
+ protected void writeRequest(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.writeRequest(HttpState, HttpConnection)");
+
writeRequestLine(state,conn);
writeRequestHeaders(state,conn);
conn.writeLine(); // close head
@@ -769,11 +768,12 @@
* @param state the client state
* @param conn the {@link HttpConnection} to write to
*/
- protected void writeRequestLine(HttpState state, HttpConnection conn) throws IOException, HttpException {
- if (log.isDebugEnabled()) {
- log.debug("HttpMethodBase.writeRequestLine(HttpState,HttpConnection)");
- }
- String requestLine = HttpMethodBase.generateRequestLine(conn, getName(),getPath(),getQueryString(),(http11 ? "HTTP/1.1" : "HTTP/1.0"));
+ protected void writeRequestLine(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.writeRequestLine(HttpState, HttpConnection)");
+
+ String requestLine = HttpMethodBase.generateRequestLine(conn, getName(), getPath(),
+ getQueryString(),(http11 ? "HTTP/1.1" : "HTTP/1.0"));
conn.print(requestLine);
}
@@ -793,10 +793,10 @@
* @param state the client state
* @param conn the {@link HttpConnection} to write to
*/
- protected void writeRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
- if (log.isDebugEnabled()) {
- log.debug("HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection)");
- }
+ protected void writeRequestHeaders(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.writeRequestHeaders(HttpState, HttpConnection)");
+
addRequestHeaders(state,conn);
Iterator it = requestHeaders.values().iterator();
while(it.hasNext()) {
@@ -824,7 +824,10 @@
* @param state the client state
* @param conn the {@link HttpConnection} the headers will eventually be written to
*/
- protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void addRequestHeaders(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.addRequestHeaders(HttpState, HttpConnection)");
+
addUserAgentRequestHeader(state,conn);
addHostRequestHeader(state,conn);
addCookieRequestHeader(state,conn);
@@ -838,7 +841,10 @@
* as long as no <tt>User-Agent</tt> request header
* already exists.
*/
- protected void addUserAgentRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void addUserAgentRequestHeader(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, HttpConnection)");
+
if (!requestHeaders.containsKey("user-agent")) {
setRequestHeader(HttpMethodBase.USER_AGENT);
}
@@ -849,7 +855,10 @@
* as long as no <tt>Host</tt> request header
* already exists.
*/
- protected void addHostRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void addHostRequestHeader(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, HttpConnection)");
+
// Per 19.6.1.1 of RFC 2616, it is legal for HTTP/1.0 based
// applications to send the Host request-header.
// TODO: Add the ability to disable the sending of this header for HTTP/1.0 requests.
@@ -873,8 +882,12 @@
/**
* Adds a <tt>Cookie</tt> request containing the matching {@link Cookie}s.
*/
- protected void addCookieRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException {
- Header cookieHeader = Cookie.createCookieHeader(conn.getHost(), conn.getPort(), getPath(), conn.isSecure(), new Date(), state.getCookies());
+ protected void addCookieRequestHeader(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.addCookieRequestHeaders(HttpState, HttpConnection)");
+
+ Header cookieHeader = Cookie.createCookieHeader(conn.getHost(), conn.getPort(),
+ getPath(), conn.isSecure(), new Date(), state.getCookies());
if(null != cookieHeader) {
setRequestHeader(cookieHeader);
}
@@ -885,7 +898,10 @@
* as long as no <tt>Authorization</tt> request header
* already exists.
*/
- protected void addAuthorizationRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void addAuthorizationRequestHeader(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.addAuthorizationRequestHeader(HttpState, HttpConnection)");
+
// add authorization header, if needed
if (!requestHeaders.containsKey(Authenticator.WWW_AUTH_RESP.toLowerCase())) {
Header wwwAuthenticateHeader = (Header)(responseHeaders.get(Authenticator.WWW_AUTH.toLowerCase()));
@@ -904,8 +920,11 @@
* as long as no <tt>Proxy-Authorization</tt> request header
* already exists.
*/
- protected void addProxyAuthorizationRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException {
- // add authorization header, if needed
+ protected void addProxyAuthorizationRequestHeader(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.addProxyAuthorizationRequestHeader(HttpState, HttpConnection)");
+
+ // add proxy authorization header, if needed
if (!requestHeaders.containsKey(Authenticator.PROXY_AUTH_RESP.toLowerCase())) {
Header wwwAuthenticateHeader = (Header)(responseHeaders.get(Authenticator.PROXY_AUTH.toLowerCase()));
if (null != wwwAuthenticateHeader) {
@@ -924,7 +943,10 @@
* as long as no <tt>Content-Length</tt> request header
* already exists.
*/
- protected void addContentLengthRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void addContentLengthRequestHeader(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.addProxyAuthorizationRequestHeader(HttpState, HttpConnection)");
+
// add content length or chunking
int len = getRequestContentLength();
if (!requestHeaders.containsKey("content-length")) {
@@ -969,7 +991,8 @@
* This implementation writes nothing and returns <tt>true</tt>.
* @return <tt>true</tt>
*/
- protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected boolean writeRequestBody(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
return true;
}
@@ -1010,10 +1033,10 @@
* @param state the client state
* @param conn the {@link HttpConnection} to read the response from
*/
- protected void readResponse(HttpState state, HttpConnection conn) throws IOException, HttpException {
- if (log.isDebugEnabled()) {
- log.debug("HttpMethodBase.readResponse(HttpState,HttpConnection)");
- }
+ protected void readResponse(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.debug("enter HttpMethodBase.readResponse(HttpState, HttpConnection)");
+
readStatusLine(state,conn);
processStatusLine(state,conn);
readResponseHeaders(state,conn);
@@ -1036,10 +1059,10 @@
* @param state the client state
* @param conn the {@link HttpConnection} to read the response from
*/
- protected void readStatusLine(HttpState state, HttpConnection conn) throws IOException, HttpException {
- if (log.isDebugEnabled()) {
- log.debug("HttpMethodBase.readStatusLine(HttpState,HttpConnection)");
- }
+ protected void readStatusLine(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.readStatusLine(HttpState, HttpConnection)");
+
statusCode = -1;
statusText = null;
@@ -1116,16 +1139,15 @@
* @param state the client state
* @param conn the {@link HttpConnection} to read the response from
*/
- protected void readResponseHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void readResponseHeaders(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
// "It must be possible to combine the multiple header fields into
// one "field-name: field-value" pair, without changing the
// semantics of the message, by appending each subsequent field-value
// to the first, each separated by a comma."
// - HTTP/1.0 (4.3)
- if (log.isDebugEnabled()) {
- log.debug("HttpMethodBase.readResponseHeaders(HttpState,HttpConnection)");
- }
+ log.trace("enter HttpMethodBase.readResponseHeaders(HttpState, HttpConnection)");
responseHeaders.clear();
String name = null;
@@ -1206,6 +1228,8 @@
* @param conn the {@link HttpConnection} to read the response from
*/
protected void processResponseHeaders(HttpState state, HttpConnection conn) {
+ log.trace("enter HttpMethodBase.processResponseHeaders(HttpState, HttpConnection)");
+
// add cookies, if any
// should we set cookies?
Header setCookieHeader = getResponseHeader("set-cookie2");
@@ -1217,8 +1241,8 @@
try {
Cookie[] cookies = Cookie.parse(conn.getHost(), conn.getPort(), getPath(), conn.isSecure(), setCookieHeader);
state.addCookies(cookies);
- } catch (Exception e) {
- log.error("processResponseHeaders(HttpState,HttpConnection)",e);
+ } catch (Exception ex) {
+ log.error("Exception caught when processing cookies", ex);
}
}
}
@@ -1241,7 +1265,10 @@
* @param state the client state
* @param conn the {@link HttpConnection} to read the response from
*/
- protected void readResponseBody(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void readResponseBody(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HttpMethodBase.readResponseBody(HttpState, HttpConnection)");
+
ByteArrayOutputStream out = new ByteArrayOutputStream();
readResponseBody(state, conn, out);
@@ -1267,10 +1294,9 @@
* @param conn the {@link HttpConnection} to read the response from
* @param out OutputStream to write the response body to
*/
- protected void readResponseBody(HttpState state, HttpConnection conn, OutputStream out) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("HttpMethodBase.readResponseBody(HttpState,HttpConnection)");
- }
+ protected void readResponseBody(HttpState state, HttpConnection conn, OutputStream out)
+ throws IOException {
+ log.trace("enter HttpMethodBase.readResponseBody(HttpState, HttpConnection)");
responseBody = null;
int expectedLength = 0;
@@ -1351,6 +1377,8 @@
* once this method has been called.
*/
public void recycle() {
+ log.trace("enter HttpMethodBase.recycle()");
+
path = null;
followRedirects = false;
queryString = null;
@@ -1409,6 +1437,8 @@
* the specified attributes.
*/
protected static String generateRequestLine(HttpConnection connection, String name, String reqPath, String qString, String protocol) {
+ log.trace("enter HttpMethodBase.generateRequestLine(HttpConnection, String, String, String, String)");
+
StringBuffer buf = new StringBuffer();
buf.append(null == reqPath ? "/" : URIUtil.encode(reqPath,URIUtil.pathSafe()));
if (null != qString) {
@@ -1450,8 +1480,9 @@
* @param status - the HTTP status code
* @return true if the message may contain a body, false if it can not contain a message body
*/
- private static boolean canResponseHaveBody(int status)
- {
+ private static boolean canResponseHaveBody(int status) {
+ log.trace("enter HttpMethodBase.canResponseHaveBody(int)");
+
boolean result = true;
if((status >= 100 && status <= 199) || // 1XX
@@ -1471,6 +1502,8 @@
*
*/
private static boolean isIpAddress(String value) {
+ log.trace("enter HttpMethodBase.isIpAddress(String)");
+
value = value.trim();
// prevent input values of 127.0.0.1. or .127.0.0.1, etc.
@@ -1528,10 +1561,10 @@
// -------------------------------------------------------------- Constants
- /** <tt>org.apache.commons.httpclient.HttpMethod</tt> log. */
- private static final Log log = LogFactory.getLog(HttpMethod.class.getName());
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(HttpMethod.class);
- /** <tt>httpclient.wire</tt> log. */
+ /** Log for any wire messages. */
private static final Log wireLog = LogFactory.getLog("httpclient.wire");
/** <tt>User-Agent: Jakarta HTTP Client/1.0</tt> header. */
1.13 +7 -6 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMultiClient.java
Index: HttpMultiClient.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMultiClient.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpMultiClient.java 28 Jul 2002 06:23:06 -0000 1.12
+++ HttpMultiClient.java 28 Jul 2002 18:08:57 -0000 1.13
@@ -84,7 +84,7 @@
// -------------------------------------------------------- Class Variables
- /** logging output */
+ /** Log object for this class. */
private static final Log log = LogFactory.getLog(HttpMultiClient.class);
// ----------------------------------------------------- Instance Variables
@@ -285,8 +285,9 @@
* @throws HttpException if a protocol exception occurs
*
*/
- public int executeMethod(HttpUrlMethod method) throws IOException,
- HttpException {
+ public int executeMethod(HttpUrlMethod method)
+ throws IOException, HttpException {
+ log.trace("enter executeMethod(HttpUrlMethod)");
if (null == method) {
throw new NullPointerException("method parameter");
1.2 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java
Index: HttpRecoverableException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpRecoverableException.java 22 Feb 2002 19:24:23 -0000 1.1
+++ HttpRecoverableException.java 28 Jul 2002 18:08:57 -0000 1.2
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.4 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpSharedState.java
Index: HttpSharedState.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpSharedState.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpSharedState.java 28 Jul 2002 11:42:05 -0000 1.3
+++ HttpSharedState.java 28 Jul 2002 18:08:57 -0000 1.4
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.9 +27 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java
Index: HttpState.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HttpState.java 21 Jul 2002 04:12:45 -0000 1.8
+++ HttpState.java 28 Jul 2002 18:08:57 -0000 1.9
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,6 +67,9 @@
import java.util.HashMap;
import java.util.Iterator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* <p>
* A container for HTTP attributes that may persist from request
@@ -97,6 +100,11 @@
*/
private ArrayList cookies = new ArrayList();
+ // -------------------------------------------------------- Class Variables
+
+ /** Log object for this class. */
+ public static final Log log = LogFactory.getLog(HttpState.class);
+
// ------------------------------------------------------------- Properties
/**
@@ -106,6 +114,8 @@
* @param cookie the {@link Cookie} to add
*/
public void addCookie(Cookie cookie) {
+ log.trace("enter HttpState.addCookie(Cookie)");
+
if (cookie != null) {
// first remove any old cookie that is equivalent
for (Iterator it = cookies.iterator();it.hasNext(); ) {
@@ -128,6 +138,8 @@
* @param newcookies the {@link Cookie}s to add
*/
public void addCookies(Cookie[] newcookies) {
+ log.trace("enter HttpState.addCookies(Cookie[])");
+
if (newcookies != null) {
for (int i = 0; i < newcookies.length; i++) {
this.addCookie(newcookies[i]);
@@ -140,6 +152,7 @@
* @return an array of my {@link Cookie}s.
*/
public Cookie[] getCookies() {
+ log.trace("enter HttpState.getCookies()");
return (Cookie[])(cookies.toArray(new Cookie[cookies.size()]));
}
@@ -155,6 +168,8 @@
* @see Cookie#matches
*/
public Cookie[] getCookies(String domain, int port, String path, boolean secure, Date now) {
+ log.trace("enter HttpState.getCookies(String, int, String, boolean, Date)");
+
ArrayList list = new ArrayList(cookies.size());
for(int i=0,m=cookies.size();i<m;i++) {
Cookie c = (Cookie)(cookies.get(i));
@@ -173,6 +188,7 @@
* @see #purgeExpiredCookies(java.util.Date)
*/
public boolean purgeExpiredCookies() {
+ log.trace("enter HttpState.purgeExpiredCookies()");
return purgeExpiredCookies(new Date());
}
@@ -182,6 +198,7 @@
* @see Cookie#isExpired(java.util.Date)
*/
public boolean purgeExpiredCookies(Date date) {
+ log.trace("enter HttpState.purgeExpiredCookies(Date)");
boolean removed = false;
Iterator it = cookies.iterator();
while(it.hasNext()) {
@@ -209,6 +226,7 @@
* @param credentials the authentication credentials for the given realm
*/
public void setCredentials(String realm, Credentials credentials) {
+ log.trace("enter HttpState.setCredentials(String, Credentials)");
credMap.put(realm,credentials);
}
@@ -225,6 +243,8 @@
* @see #setCredentials
*/
public Credentials getCredentials(String realm) {
+ log.trace("enter HttpState.getCredentials(String)");
+
Credentials creds = (Credentials) credMap.get(realm);
if (creds == null) {
creds = (Credentials) credMap.get(null);
@@ -249,6 +269,7 @@
* @param credentials the authentication credentials for the given realm
*/
public void setProxyCredentials(String realm, Credentials credentials) {
+ log.trace("enter HttpState.setProxyCredentials(String, credentials)");
proxyCred.put(realm, credentials);
}
@@ -265,6 +286,7 @@
* @see #setProxyCredentials
*/
public Credentials getProxyCredentials(String realm) {
+ log.trace("enter HttpState.getProxyCredentials(String)");
Credentials creds = (Credentials) proxyCred.get(realm);
if (creds == null) {
creds = (Credentials) proxyCred.get(null);
1.7 +15 -8 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpStatus.java
Index: HttpStatus.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpStatus.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- HttpStatus.java 4 Mar 2002 03:24:50 -0000 1.6
+++ HttpStatus.java 28 Jul 2002 18:08:57 -0000 1.7
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -64,6 +64,9 @@
import java.util.Hashtable;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
/**
* <p>Constants enumerating the HTTP status codes.</p>
* @version $Id$
@@ -71,11 +74,14 @@
public class HttpStatus {
- // -------------------------------------------------------------- Variables
+ // -------------------------------------------------------- Class Variables
/** Reason phrases (as Strings), by status code (as Integer). */
private static Hashtable mapStatusCodes = new Hashtable();
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(HttpStatus.class);
+
// --------------------------------------------------------- Public Methods
@@ -87,10 +93,11 @@
* @return the reason phrase associated with the given status code
*/
public static String getStatusText(int nHttpStatusCode) {
- Integer intKey = new Integer(nHttpStatusCode);
+ log.trace("enter HttpStatus.getStatusText(int)");
+ Integer intKey = new Integer(nHttpStatusCode);
if (!mapStatusCodes.containsKey(intKey)) {
- // No information
+ log.warn("No status text available for status code " + nHttpStatusCode);
return null;
} else {
1.3 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java
Index: HttpUrlMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HttpUrlMethod.java 28 Mar 2002 03:53:13 -0000 1.2
+++ HttpUrlMethod.java 28 Jul 2002 18:08:57 -0000 1.3
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.8 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/NameValuePair.java
Index: NameValuePair.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/NameValuePair.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NameValuePair.java 5 Jan 2002 11:16:00 -0000 1.7
+++ NameValuePair.java 28 Jul 2002 18:08:57 -0000 1.8
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.11 +29 -17 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java
Index: RequestOutputStream.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RequestOutputStream.java 21 Jul 2002 04:12:45 -0000 1.10
+++ RequestOutputStream.java 28 Jul 2002 18:08:57 -0000 1.11
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -114,6 +114,10 @@
// ------------------------------------------------------- Static Variables
+ /** Log object for this class. */
+ static private final Log log = LogFactory.getLog(RequestOutputStream.class);
+
+ /** Log for any wire messages. */
static private final Log wireLog = LogFactory.getLog("httpclient.wire");
// ----------------------------------------------------- Instance Variables
@@ -195,6 +199,8 @@
* @exception IOException if an input or output exception occurred
*/
public void print(String s) throws IOException {
+ log.trace("enter RequestOutputStream.print(String)");
+
if (s == null) {
s = "null";
}
@@ -236,6 +242,8 @@
* @exception IOException if an input/output error occurs
*/
public void write(int b) throws IOException {
+
+ //TODO: If using chunking, the chunks are one byte long!
if (useChunking) {
stream.write(one, 0, one.length);
stream.write(crlf, 0, crlf.length);
@@ -257,6 +265,8 @@
* Write the specified byte array.
*/
public void write(byte[] b, int off, int len) throws IOException {
+ log.trace("enter RequestOutputStream.write(byte[], int, int)");
+
if (useChunking) {
byte chunkHeader[] =
(Integer.toHexString(len) + "\r\n").getBytes();
@@ -280,21 +290,23 @@
* any further output data to throw an IOException.
*/
public void close() throws IOException {
+ log.trace("enter RequestOutputStream.close()");
if (this.closed == false) {
try {
- if (useChunking) {
- // Write the final chunk.
- stream.write(zero, 0, zero.length);
- stream.write(crlf, 0, crlf.length);
- stream.write(endChunk, 0, endChunk.length);
- if(wireLog.isInfoEnabled()) {
- wireLog.info(">> byte 0 \\r\\n\\r\\n (final chunk)");
- }
- }
- super.close();
- } catch (java.io.IOException ex) {
- throw ex;
+ if (useChunking) {
+ // Write the final chunk.
+ stream.write(zero, 0, zero.length);
+ stream.write(crlf, 0, crlf.length);
+ stream.write(endChunk, 0, endChunk.length);
+ if(wireLog.isInfoEnabled()) {
+ wireLog.info(">> byte 0 \\r\\n\\r\\n (final chunk)");
+ }
+ }
+ super.close();
+ } catch (IOException ioe) {
+ log.debug("Unexpected exception caught when closing output stream", ioe);
+ throw ioe;
} finally {
this.closed = true;
}
1.16 +33 -13 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java
Index: ResponseInputStream.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ResponseInputStream.java 21 Jul 2002 04:12:45 -0000 1.15
+++ ResponseInputStream.java 28 Jul 2002 18:08:57 -0000 1.16
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,6 +65,8 @@
import java.io.IOException;
import java.io.InputStream;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
/**
* <p>{@link InputStream} wrapper supporting the chunked transfer encoding.</p>
*
@@ -78,6 +80,15 @@
*/
public class ResponseInputStream extends InputStream {
+ // -------------------------------------------------------- Class Variables
+
+ /** Log object for this class. */
+ public static final Log log = LogFactory.getLog(ResponseInputStream.class);
+
+ /** Log for wire messages. */
+ public static final Log wireLog = LogFactory.getLog("httpclient.wire");
+
+
// ----------------------------------------------------------- Constructors
/**
@@ -88,6 +99,8 @@
*
*/
public ResponseInputStream(InputStream stream, boolean chunked, int contentLength) {
+ log.trace("enter ResponseInputStream(InputStream, boolean, int)");
+
if (null == stream) {
throw new NullPointerException("InputStream parameter is null");
}
@@ -107,6 +120,7 @@
*/
public ResponseInputStream(InputStream stream, HttpMethod method) {
super();
+ log.trace("enter ResponseInputStream(InputStream, HttpMethod)");
if (null == stream) {
throw new NullPointerException("InputStream parameter is null");
@@ -198,15 +212,16 @@
* If a content length has been set but not all of the bytes have yet been
* consumed, the remaining bytes will be swallowed.
*/
- public void close()
- throws IOException {
-/*
+ public void close() throws IOException {
+ log.trace("enter ResponseInputStream.close()");
+ /*
// Xerces appears to doubly-close the input stream...
if(closed) {
throw new IOException("Stream is already closed");
}
-*/
+ */
+ //TODO: This close code is not very robust
if (!closed) {
try {
if (chunk) {
@@ -248,7 +263,9 @@
*
* @exception IOException if an input/output error occurs
*/
- public int read(byte b[], int off, int len) throws IOException {
+ public int read(byte b[], int off, int len)
+ throws IOException {
+ log.trace("enter ResponseInputStream.read(byte, int, int)");
int avail = length - pos;
if ((avail == 0) && (!fillBuffer()))
@@ -269,7 +286,6 @@
System.arraycopy(buffer, pos, b, off, toCopy);
pos += toCopy;
return toCopy;
-
}
/**
@@ -279,7 +295,8 @@
* @exception IOException if an input/output error occurs
*/
public int read()
- throws IOException {
+ throws IOException {
+ log.trace("enter ResponseInputStream.read()");
if (pos == length) {
if (!fillBuffer())
@@ -297,6 +314,7 @@
* Fill the chunk buffer.
*/
private boolean fillBuffer() throws IOException {
+ log.trace("enter ResponseInputStream.fillBuffer()");
// Has this stream been closed?
if (closed)
@@ -400,8 +418,10 @@
* @exception IOException if an input or output exception has occurred
*/
private String readLineFromStream()
- throws IOException {
+ throws IOException {
+ log.trace("enter ResponseInputStream.ReadLineFromStream()");
+ //TODO: Reformat this code
StringBuffer sb = new StringBuffer();
while (true) {
int ch = stream.read();
1.9 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java
Index: URIUtil.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- URIUtil.java 22 Jul 2002 15:35:12 -0000 1.8
+++ URIUtil.java 28 Jul 2002 18:08:57 -0000 1.9
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.5 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
Index: UsernamePasswordCredentials.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/UsernamePasswordCredentials.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UsernamePasswordCredentials.java 5 Jan 2002 11:16:00 -0000 1.4
+++ UsernamePasswordCredentials.java 28 Jul 2002 18:08:57 -0000 1.5
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.6 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/DeleteMethod.java
Index: DeleteMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/DeleteMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DeleteMethod.java 21 Jul 2002 04:12:46 -0000 1.5
+++ DeleteMethod.java 28 Jul 2002 18:08:58 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.13 +25 -10 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java
Index: GetMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- GetMethod.java 23 Jul 2002 14:38:31 -0000 1.12
+++ GetMethod.java 28 Jul 2002 18:08:59 -0000 1.13
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -91,10 +91,10 @@
// -------------------------------------------------------------- Constants
- /** <tt>org.apache.commons.httpclient.methods.GetMethod</tt> log. */
- private static final Log log = LogFactory.getLog(GetMethod.class.getName());
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(GetMethod.class);
- /** <tt>httpclient.wire</tt> log. */
+ /** Log for any wire messages. */
private static final Log wireLog = LogFactory.getLog("httpclient.wire");
/** Temporary directory. */
@@ -117,6 +117,7 @@
*/
public GetMethod(String path) {
super(path);
+ log.trace("enter GetMethod(String)");
setFollowRedirects(true);
}
@@ -128,6 +129,7 @@
*/
public GetMethod(String path, String tempDir) {
super(path);
+ log.trace("enter GetMethod(String, String)");
setUseDisk(true);
setTempDir(tempDir);
setFollowRedirects(true);
@@ -141,6 +143,7 @@
*/
public GetMethod(String path, String tempDir, String tempFile) {
super(path);
+ log.trace("enter GetMethod(String, String, String)");
setUseDisk(true);
setTempDir(tempDir);
setTempFile(tempFile);
@@ -154,6 +157,7 @@
*/
public GetMethod(String path, File fileData) {
this(path);
+ log.trace("enter GetMethod(String, File)");
useDisk = true;
this.fileData = fileData;
setFollowRedirects(true);
@@ -285,6 +289,8 @@
// override recycle to reset redirects default
public void recycle() {
+ log.trace("enter GetMethod.recycle()");
+
super.recycle();
this.memoryData = null;
this.fileData = null;
@@ -297,6 +303,8 @@
* Otherwise return <tt>null</tt>.
*/
public byte[] getResponseBody() {
+ log.trace("enter GetMethod.getResponseBody()");
+
checkUsed();
if(useDisk) {
try {
@@ -327,6 +335,8 @@
* Otherwise return <tt>null</tt>.
*/
public String getResponseBodyAsString() {
+ log.trace("enter GetMethod.getResponseBodyAsString()");
+
byte[] data = getResponseBody();
if(null == data) {
return null;
@@ -341,7 +351,10 @@
* as an {@link InputStream}.
* Otherwise return <tt>null</tt>.
*/
- public InputStream getResponseBodyAsStream() throws IOException {
+ public InputStream getResponseBodyAsStream()
+ throws IOException {
+ log.trace("enter GetMethod.getResponseBodyAsStream()");
+
checkUsed();
if (useDisk) {
return new FileInputStream(fileData);
@@ -361,8 +374,10 @@
* Overrides method in {@link HttpMethodBase} to
* write data to the appropriate buffer.
*/
- protected void readResponseBody(HttpState state, HttpConnection conn) throws IOException {
- log.debug("GetMethod.readResponseBody(HttpState,HttpConnection)");
+ protected void readResponseBody(HttpState state, HttpConnection conn)
+ throws IOException {
+ log.trace("enter GetMethod.readResponseBody(HttpState, HttpConnection)");
+
OutputStream out = null;
if (useDisk) {
if (fileData == null) {
1.9 +11 -9 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java
Index: HeadMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HeadMethod.java 21 Jul 2002 04:12:46 -0000 1.8
+++ HeadMethod.java 28 Jul 2002 18:08:59 -0000 1.9
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -66,6 +66,7 @@
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethodBase;
import org.apache.commons.httpclient.HttpState;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -128,14 +129,15 @@
* presence of a <tt>Content-Length</tt> or
* <tt>Transfer-Encoding</tt> header.
*/
- protected void readResponseBody(HttpState state, HttpConnection conn) throws IOException, HttpException {
- log.debug("HeadMethod.readResponseBody(HttpState,HttpConnection)");
+ protected void readResponseBody(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter HeadMethod.readResponseBody(HttpState, HttpConnection)");
return; // despite the possible presence of a content-length header, HEAD returns no response body
}
- // -------------------------------------------------------------- Constants
+ // -------------------------------------------------------------- Class Variables
- /** <tt>org.apache.commons.httpclient.methods.HeadMethod</tt> log. */
- private static final Log log = LogFactory.getLog(HeadMethod.class.getName());
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(HeadMethod.class);
}
1.7 +11 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/OptionsMethod.java
Index: OptionsMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/OptionsMethod.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- OptionsMethod.java 21 Jul 2002 04:12:46 -0000 1.6
+++ OptionsMethod.java 28 Jul 2002 18:08:59 -0000 1.7
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,6 +67,8 @@
import org.apache.commons.httpclient.HttpMethodBase;
import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -81,8 +83,10 @@
extends HttpMethodBase {
- // -------------------------------------------------------------- Constants
+ // --------------------------------------------------------- Class Variables
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(OptionsMethod.class);
// ----------------------------------------------------------- Constructors
@@ -139,6 +143,8 @@
// ----------------------------------------------------- HttpMethod Methods
protected void processResponseHeaders(HttpState state, HttpConnection conn) {
+ log.trace("enter OptionsMethod.processResponseHeaders(HttpState, HttpConnection)");
+
Header allowHeader = getResponseHeader("allow");
if (allowHeader != null) {
String allowHeaderValue = allowHeader.getValue();
1.15 +46 -9 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMethod.java
Index: PostMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMethod.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- PostMethod.java 24 Jul 2002 03:00:11 -0000 1.14
+++ PostMethod.java 28 Jul 2002 18:08:59 -0000 1.15
@@ -184,6 +184,7 @@
* to clear my request body.
*/
public void recycle() {
+ log.trace("enter PostMethod.recycle()");
super.recycle();
requestBody = null;
requestContentLength = CONTENT_LENGTH_AUTO;
@@ -199,6 +200,8 @@
* @deprecated use #removeParameter followed by #setParameter
*/
public void setParameter(String parameterName, String parameterValue) {
+ log.trace("enter PostMethod.setParameter(String, String)");
+
if(null != requestBody) {
throw new IllegalStateException("Request body already generated.");
}
@@ -224,6 +227,8 @@
*
*/
public void setRequestContentLength(int length) {
+ log.trace("enter PostMethod.setRequestContentLength(int)");
+
if ((length == CONTENT_LENGTH_CHUNKED) && !isHttp11()) {
throw new RuntimeException("Chunked transfer encoding not allowed for HTTP/1.0");
}
@@ -239,6 +244,8 @@
* @throws IllegalArgumentException if either argument is null
*/
public void addParameter(String paramName, String paramValue) {
+ log.trace("enter PostMethod.addParameter(String, String)");
+
if(null != requestBody) {
throw new IllegalStateException("Request body already generated.");
}
@@ -260,6 +267,8 @@
* @since 2.0
*/
public void addParameter(NameValuePair param) {
+ log.trace("enter PostMethod.addParameter(NameValuePair)");
+
if(null != requestBody) {
throw new IllegalStateException("Request body already generated.");
}
@@ -280,6 +289,8 @@
* @since 2.0
*/
public void addParameters(NameValuePair[] parameters) {
+ log.trace("enter PostMethod.addParameters(NameValuePair[])");
+
if(null != requestBody) {
throw new IllegalStateException("Request body already generated.");
}
@@ -304,6 +315,8 @@
* @since 2.0
*/
public NameValuePair getParameter(String paramName){
+ log.trace("enter PostMethod.getParameter(String)");
+
if (paramName == null){
return null;
}
@@ -331,6 +344,8 @@
* @since 2.0
*/
public NameValuePair[] getParameters(){
+ log.trace("enter PostMethod.getParameters()");
+
int numPairs = parameters.size();
Object[] objectArr= parameters.toArray();
NameValuePair[] nvPairArr = new NameValuePair[numPairs];
@@ -351,6 +366,8 @@
* @throws IllegalStateException if my request body has already been generated.
*/
public boolean removeParameter(String paramName) {
+ log.trace("enter PostMethod.removeParameter(String)");
+
if(null != requestBody) {
throw new IllegalStateException("Request body already generated.");
}
@@ -380,6 +397,8 @@
* @throws IllegalStateException if my request body has already been generated.
*/
public boolean removeParameter(String paramName, String paramValue) {
+ log.trace("enter PostMethod.removeParameter(String, String)");
+
if(null != requestBody) {
throw new IllegalStateException("Request body already generated.");
}
@@ -408,6 +427,8 @@
* encoding. Use setRequestBody(InputStream) instead.
*/
public void setRequestBody(String body) {
+ log.trace("enter PostMethod.setRequestBody(String)");
+
if(!parameters.isEmpty()) {
throw new IllegalStateException("Request parameters have already been added.");
}
@@ -415,6 +436,8 @@
}
public void setRequestBody(InputStream body) {
+ log.trace("enter PostMethod.getRequestBody(InputStream)");
+
if(!parameters.isEmpty()) {
throw new IllegalStateException("Request parameters have already been added.");
}
@@ -429,6 +452,8 @@
* @since 2.0
*/
public InputStream getRequestBody() {
+ log.trace("enter PostMethod.getRequestBody()");
+
if (requestBody != null) {
return requestBody;
} else if (!parameters.isEmpty()) {
@@ -442,6 +467,8 @@
*@return the request body as a string
*/
public String getRequestBodyAsString() throws IOException{
+ log.trace("enter PostMethod.getRequestBodyAsString()");
+
StringBuffer buffer = new StringBuffer();
InputStream requestBody = getRequestBody();
int data = requestBody.read();
@@ -454,10 +481,12 @@
/**
- * Override method of {@link org.apache.commons.httpclient.HttpMethodBase} to also add <tt>Content-Type</tt> header
+ * Override method of {@link org.apache.commons.httpclient.HttpMethodBase} to
+ * also add <tt>Content-Type</tt> header
* when appropriate.
*/
- protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void addRequestHeaders(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
super.addRequestHeaders(state,conn);
if(!parameters.isEmpty()) { //there are some parameters, so set the contentType header
setRequestHeader(CONTENT_TYPE);
@@ -476,8 +505,10 @@
*
* @return always returns true
*/
- protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException {
- log.debug("PostMethod.writeRequestBody(HttpState,HttpConnection)");
+ protected boolean writeRequestBody(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter PostMethod.writeRequestBody(HttpState, HttpConnection)");
+
if(null == requestBody) {
requestBody = generateRequestBody(parameters);
}
@@ -516,6 +547,8 @@
@return number of bytes in the request body
*/
protected int getRequestContentLength() {
+ log.trace("enter PostMethod.getRequestContentLength()");
+
if(null == requestBody) {
requestBody = generateRequestBody(parameters);
bufferContent();
@@ -535,6 +568,8 @@
* If the method was called earlier it returns immediately.
*/
private void bufferContent() {
+ log.trace("enter PostMethod.bufferContent()");
+
if (buffer != null) return;
try {
buffer = new ByteArrayOutputStream();
@@ -563,6 +598,8 @@
* @return urlencoded string
*/
static InputStream generateRequestBody(List params) {
+ log.trace("enter PostMethod.generateRequestBody(List)");
+
Iterator it = params.iterator();
StringBuffer sb = new StringBuffer();
while(it.hasNext()) {
@@ -588,8 +625,8 @@
// -------------------------------------------------------------- Constants
- /** <tt>org.apache.commons.httpclient.methods.PostMethod</tt> log. */
- private static final Log log = LogFactory.getLog(PostMethod.class.getName());
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(PostMethod.class);
/** The Content-Type header for www-form-urlcoded. */
static final Header CONTENT_TYPE = new Header ("Content-Type","application/x-www-form-urlencoded");
1.12 +21 -11 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PutMethod.java
Index: PutMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PutMethod.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- PutMethod.java 23 Jul 2002 14:38:31 -0000 1.11
+++ PutMethod.java 28 Jul 2002 18:08:59 -0000 1.12
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -85,8 +85,7 @@
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
*/
-public class PutMethod
- extends HttpMethodBase {
+public class PutMethod extends HttpMethodBase {
// ----------------------------------------------------------- Constructors
@@ -179,7 +178,10 @@
* memory. To upload large entities, it is recommended to first buffer the
* data into a temporary file, and then send that file.
*/
- public void setRequestBody(InputStream is) throws IOException {
+ public void setRequestBody(InputStream is)
+ throws IOException {
+ log.trace("enter PutMethod.setRequestBody(InputStream)");
+
checkNotUsed();
byte[] buffer = new byte[4096];
ByteArrayOutputStream os = new ByteArrayOutputStream();
@@ -203,7 +205,10 @@
* not already been set, in addition to the "standard"
* set of headers.
*/
- protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected void addRequestHeaders(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter PutMethod.addRequestHeaders(HttpState, HttpConnection)");
+
super.addRequestHeaders(state,conn);
// Send expectation header
if(isHttp11() && null == getRequestHeader("expect")) {
@@ -217,7 +222,10 @@
* the <tt>100 Continue</tt> status has not be
* read.
*/
- protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException {
+ protected boolean writeRequestBody(HttpState state, HttpConnection conn)
+ throws IOException, HttpException {
+ log.trace("enter PutMethod.writeRequestBody(HttpState, HttpConnection)");
+
if(null != getRequestHeader("expect") && getStatusCode() != HttpStatus.SC_CONTINUE) {
return false;
}
@@ -253,6 +261,8 @@
* to return the appropriate content length.
*/
protected int getRequestContentLength() {
+ log.trace("enter PutMethod.getRequestContentLength()");
+
if(null != data) {
return data.length;
} else if(null != file && file.exists()) {
@@ -273,6 +283,6 @@
file = null;
}
- /** <tt>org.apache.commons.httpclient.methods.PutMethod</tt> log. */
- private static final Log log = LogFactory.getLog(PutMethod.class.getName());
+ /** Log object for this class. */
+ private static final Log log = LogFactory.getLog(PutMethod.class);
}
1.6 +8 -9 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
Index: UrlDeleteMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlDeleteMethod.java 21 Jul 2002 04:12:46 -0000 1.5
+++ UrlDeleteMethod.java 28 Jul 2002 18:08:59 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,6 +74,7 @@
*/
public class UrlDeleteMethod extends DeleteMethod implements HttpUrlMethod
{
+
// ----------------------------------------------------- Instance Variables
private String url;
@@ -101,8 +102,7 @@
*
* @param url - the URL for this request.
*/
- public void setUrl(String url) throws MalformedURLException
- {
+ public void setUrl(String url) throws MalformedURLException {
setPath(URIUtil.getPath(url));
this.url = url;
String query = URIUtil.getQueryString(url);
@@ -112,10 +112,9 @@
}
/**
- *
+ * Gets the Url.
*/
- public String getUrl()
- {
+ public String getUrl() {
return url;
}
1.6 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java
Index: UrlGetMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlGetMethod.java 21 Jul 2002 04:12:46 -0000 1.5
+++ UrlGetMethod.java 28 Jul 2002 18:08:59 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.6 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
Index: UrlHeadMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlHeadMethod.java 21 Jul 2002 04:12:46 -0000 1.5
+++ UrlHeadMethod.java 28 Jul 2002 18:08:59 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.6 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
Index: UrlOptionsMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlOptionsMethod.java 21 Jul 2002 04:12:46 -0000 1.5
+++ UrlOptionsMethod.java 28 Jul 2002 18:08:59 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.6 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java
Index: UrlPostMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlPostMethod.java 21 Jul 2002 04:12:46 -0000 1.5
+++ UrlPostMethod.java 28 Jul 2002 18:08:59 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.6 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java
Index: UrlPutMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlPutMethod.java 21 Jul 2002 04:12:46 -0000 1.5
+++ UrlPutMethod.java 28 Jul 2002 18:08:59 -0000 1.6
@@ -6,7 +6,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [HttpClient] Logging entries and exists
Posted by Jeff Dever <js...@sympatico.ca>.
I'm making a few waves through the logging code. I like to keep patches
releatively small, (even though my last patch was huge). I'll attack wirelog
soon.
I am intrigued about AOP. Will check it out when I get the chance.
Vincent Massol wrote:
> Jeff,
>
> This is called AOP (aspect-oriented programming), check the AspectJ
> website, there is a nice tutorial. It is not java but an extension of
> it.
>
> WRT logging, I notice that the wire logs were using the INFO level. I
> found that very strange and I would not expect wire logs unless I am
> debugging. It will also be bad on performance, don't you think ?
>
> Cheers,
> -Vincent
>
> > -----Original Message-----
> > From: jsdever [mailto:jsdever] On Behalf Of Jeff Dever
> > Sent: 29 July 2002 01:58
> > To: Jakarta Commons Developers List
> > Subject: Re: [HttpClient] Logging entries and exists
> >
> > Hey Vincent,
> >
> > The commons-logging facade was initially constructed from the
> > httpclient.log
> > package, so it was REAL easy to move to commons-logging. I asked for
> > enter(),
> > exit() calls but they were refused. It can be quite tricky dealing
> with
> > multiple exit points that is typical in exception throwing code, so I
> just
> > ended
> > up puting log.trace("Class.method()") calls in to provide some tracing
> at
> > least. Its pretty manual, but the overhead is minimal as it is just
> > logging a
> > constant string with no reflection or anything fancy.
> >
> > Cool, thats some pretty wild programming in cactus, with some syntax I
> > haven't
> > seen before. How does the following method definition work?
> > Object around() :
> > !logObjectCalls()
> > && publicMethodsWithParameterCalls()
> > && publicStaticMethodsWithParameterCalls()
> > && !publicMethodsWithReturnValueCalls()
> > {
> >
> > Vincent Massol wrote:
> >
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: [HttpClient] Logging entries and exists
Posted by Vincent Massol <vm...@octo.com>.
Jeff,
This is called AOP (aspect-oriented programming), check the AspectJ
website, there is a nice tutorial. It is not java but an extension of
it.
WRT logging, I notice that the wire logs were using the INFO level. I
found that very strange and I would not expect wire logs unless I am
debugging. It will also be bad on performance, don't you think ?
Cheers,
-Vincent
> -----Original Message-----
> From: jsdever [mailto:jsdever] On Behalf Of Jeff Dever
> Sent: 29 July 2002 01:58
> To: Jakarta Commons Developers List
> Subject: Re: [HttpClient] Logging entries and exists
>
> Hey Vincent,
>
> The commons-logging facade was initially constructed from the
> httpclient.log
> package, so it was REAL easy to move to commons-logging. I asked for
> enter(),
> exit() calls but they were refused. It can be quite tricky dealing
with
> multiple exit points that is typical in exception throwing code, so I
just
> ended
> up puting log.trace("Class.method()") calls in to provide some tracing
at
> least. Its pretty manual, but the overhead is minimal as it is just
> logging a
> constant string with no reflection or anything fancy.
>
> Cool, thats some pretty wild programming in cactus, with some syntax I
> haven't
> seen before. How does the following method definition work?
> Object around() :
> !logObjectCalls()
> && publicMethodsWithParameterCalls()
> && publicStaticMethodsWithParameterCalls()
> && !publicMethodsWithReturnValueCalls()
> {
>
> Vincent Massol wrote:
>
> > Hi Jeff,
> >
> > FWIW, in Cactus land, we had decided to go with AspectJ
> > (http://www.aspectj.org) for logging entries and exits of methods.
The
> > downside is that you need to put aspectjrt.jar (80k or so) in user
> > classpaths ...
> >
> > See
> >
http://cvs.apache.org/viewcvs/jakarta-cactus/framework/src/java/share/or
> >
g/apache/cactus/util/log/LogAspect.java?rev=1.3&content-type=text/vnd.vi
> > ewcvs-markup
> >
> > I agree that it is easier to add a jar in an application than in a
> > framework but it's a pity that increasing dependencies on jars is a
> > problem. It should not be in an ideal world ... ;-)
> >
> > Cheers,
> > -Vincent
>
>
> --
> To unsubscribe, e-mail: <mailto:commons-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-
> help@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [HttpClient] Logging entries and exists
Posted by Jeff Dever <js...@sympatico.ca>.
Hey Vincent,
The commons-logging facade was initially constructed from the httpclient.log
package, so it was REAL easy to move to commons-logging. I asked for enter(),
exit() calls but they were refused. It can be quite tricky dealing with
multiple exit points that is typical in exception throwing code, so I just ended
up puting log.trace("Class.method()") calls in to provide some tracing at
least. Its pretty manual, but the overhead is minimal as it is just logging a
constant string with no reflection or anything fancy.
Cool, thats some pretty wild programming in cactus, with some syntax I haven't
seen before. How does the following method definition work?
Object around() :
!logObjectCalls()
&& publicMethodsWithParameterCalls()
&& publicStaticMethodsWithParameterCalls()
&& !publicMethodsWithReturnValueCalls()
{
Vincent Massol wrote:
> Hi Jeff,
>
> FWIW, in Cactus land, we had decided to go with AspectJ
> (http://www.aspectj.org) for logging entries and exits of methods. The
> downside is that you need to put aspectjrt.jar (80k or so) in user
> classpaths ...
>
> See
> http://cvs.apache.org/viewcvs/jakarta-cactus/framework/src/java/share/or
> g/apache/cactus/util/log/LogAspect.java?rev=1.3&content-type=text/vnd.vi
> ewcvs-markup
>
> I agree that it is easier to add a jar in an application than in a
> framework but it's a pity that increasing dependencies on jars is a
> problem. It should not be in an ideal world ... ;-)
>
> Cheers,
> -Vincent
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
[HttpClient] Logging entries and exists
Posted by Vincent Massol <vm...@octo.com>.
Hi Jeff,
FWIW, in Cactus land, we had decided to go with AspectJ
(http://www.aspectj.org) for logging entries and exits of methods. The
downside is that you need to put aspectjrt.jar (80k or so) in user
classpaths ...
See
http://cvs.apache.org/viewcvs/jakarta-cactus/framework/src/java/share/or
g/apache/cactus/util/log/LogAspect.java?rev=1.3&content-type=text/vnd.vi
ewcvs-markup
I agree that it is easier to add a jar in an application than in a
framework but it's a pity that increasing dependencies on jars is a
problem. It should not be in an ideal world ... ;-)
Cheers,
-Vincent
> -----Original Message-----
> From: jsdever@apache.org [mailto:jsdever@apache.org]
> Sent: 28 July 2002 19:09
> To: jakarta-commons-cvs@apache.org
> Subject: cvs commit: jakarta-
> commons/httpclient/src/java/org/apache/commons/httpclient/methods
> DeleteMethod.java GetMethod.java HeadMethod.java OptionsMethod.java
> PostMethod.java PutMethod.java UrlDeleteMethod.java UrlGetMethod.java
> UrlHeadMethod.java UrlOptionsMe
>
> jsdever 2002/07/28 11:08:59
>
> Modified: httpclient/src/java/org/apache/commons/httpclient
> Authenticator.java Base64.java
ConnectMethod.java
> Cookie.java Credentials.java Header.java
> HeaderElement.java HttpClient.java
> HttpConnection.java HttpConnectionManager.java
> HttpException.java HttpMethod.java
> HttpMethodBase.java HttpMultiClient.java
> HttpRecoverableException.java
HttpSharedState.java
> HttpState.java HttpStatus.java
HttpUrlMethod.java
> NameValuePair.java RequestOutputStream.java
> ResponseInputStream.java URIUtil.java
> UsernamePasswordCredentials.java
>
> java/org/apache/commons/httpclient/Authenticator.java
> java/org/apache/commons/httpclient/Base64.java
>
> java/org/apache/commons/httpclient/ConnectMethod.java
> java/org/apache/commons/httpclient/Cookie.java
>
> java/org/apache/commons/httpclient/Credentials.java
> java/org/apache/commons/httpclient/Header.java
>
> java/org/apache/commons/httpclient/HeaderElement.java
>
java/org/apache/commons/httpclient/HttpClient.java
>
> java/org/apache/commons/httpclient/HttpConnection.java
>
> java/org/apache/commons/httpclient/HttpConnectionManager.java
>
> java/org/apache/commons/httpclient/HttpException.java
>
java/org/apache/commons/httpclient/HttpMethod.java
>
> java/org/apache/commons/httpclient/HttpMethodBase.java
>
> java/org/apache/commons/httpclient/HttpMultiClient.java
>
> java/org/apache/commons/httpclient/HttpRecoverableException.java
>
> java/org/apache/commons/httpclient/HttpSharedState.java
>
java/org/apache/commons/httpclient/HttpState.java
>
java/org/apache/commons/httpclient/HttpStatus.java
>
> java/org/apache/commons/httpclient/HttpUrlMethod.java
>
> java/org/apache/commons/httpclient/NameValuePair.java
>
> java/org/apache/commons/httpclient/RequestOutputStream.java
>
> java/org/apache/commons/httpclient/ResponseInputStream.java
>
java/org/apache/commons/httpclient/URIUtil.java
>
> java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
>
> java/org/apache/commons/httpclient/methods/DeleteMethod.java
>
> java/org/apache/commons/httpclient/methods/GetMethod.java
>
> java/org/apache/commons/httpclient/methods/HeadMethod.java
>
> java/org/apache/commons/httpclient/methods/OptionsMethod.java
>
> java/org/apache/commons/httpclient/methods/PostMethod.java
>
> java/org/apache/commons/httpclient/methods/PutMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlGetMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlPostMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlPutMethod.java
>
httpclient/src/java/org/apache/commons/httpclient/methods
> DeleteMethod.java GetMethod.java
HeadMethod.java
> OptionsMethod.java PostMethod.java
PutMethod.java
> UrlDeleteMethod.java UrlGetMethod.java
> UrlHeadMethod.java UrlOptionsMethod.java
> UrlPostMethod.java UrlPutMethod.java
>
> java/org/apache/commons/httpclient/Authenticator.java
> java/org/apache/commons/httpclient/Base64.java
>
> java/org/apache/commons/httpclient/ConnectMethod.java
> java/org/apache/commons/httpclient/Cookie.java
>
> java/org/apache/commons/httpclient/Credentials.java
> java/org/apache/commons/httpclient/Header.java
>
> java/org/apache/commons/httpclient/HeaderElement.java
>
java/org/apache/commons/httpclient/HttpClient.java
>
> java/org/apache/commons/httpclient/HttpConnection.java
>
> java/org/apache/commons/httpclient/HttpConnectionManager.java
>
> java/org/apache/commons/httpclient/HttpException.java
>
java/org/apache/commons/httpclient/HttpMethod.java
>
> java/org/apache/commons/httpclient/HttpMethodBase.java
>
> java/org/apache/commons/httpclient/HttpMultiClient.java
>
> java/org/apache/commons/httpclient/HttpRecoverableException.java
>
> java/org/apache/commons/httpclient/HttpSharedState.java
>
java/org/apache/commons/httpclient/HttpState.java
>
java/org/apache/commons/httpclient/HttpStatus.java
>
> java/org/apache/commons/httpclient/HttpUrlMethod.java
>
> java/org/apache/commons/httpclient/NameValuePair.java
>
> java/org/apache/commons/httpclient/RequestOutputStream.java
>
> java/org/apache/commons/httpclient/ResponseInputStream.java
>
java/org/apache/commons/httpclient/URIUtil.java
>
> java/org/apache/commons/httpclient/UsernamePasswordCredentials.java
>
> java/org/apache/commons/httpclient/methods/DeleteMethod.java
>
> java/org/apache/commons/httpclient/methods/GetMethod.java
>
> java/org/apache/commons/httpclient/methods/HeadMethod.java
>
> java/org/apache/commons/httpclient/methods/OptionsMethod.java
>
> java/org/apache/commons/httpclient/methods/PostMethod.java
>
> java/org/apache/commons/httpclient/methods/PutMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlGetMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlPostMethod.java
>
> java/org/apache/commons/httpclient/methods/UrlPutMethod.java
> Log:
> For feature: http://issues.apache.org/bugzilla/show_bug.cgi?id=10804
> This is a first pass, focusing on:
> - Copyright notice date
> - consistant construction of log objects
> - trace entry logs
>
> A few more passes and refinements will have to be made to complete
the
> feature.
>
> Revision Changes Path
> 1.23 +56 -31 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.
ja
> va
>
> Index: Authenticator.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.
ja
> va,v
> retrieving revision 1.22
> retrieving revision 1.23
> diff -u -r1.22 -r1.23
> --- Authenticator.java 26 Jul 2002 00:45:01 -0000 1.22
> +++ Authenticator.java 28 Jul 2002 18:08:57 -0000 1.23
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -98,7 +98,7 @@
> class Authenticator {
>
> /** <tt>org.apache.commons.httpclient.Authenticator</tt> log.
*/
> - private static final Log log =
> LogFactory.getLog(Authenticator.class.getName());
> + private static final Log log =
> LogFactory.getLog(Authenticator.class);
>
> /** Base 64 encoder. */
> private static Base64 base64 = new Base64();
> @@ -149,13 +149,12 @@
> * @see #authenticate(HttpMethod,HttpState,Header,String)
> */
> static boolean authenticate(HttpMethod method, HttpState state)
> - throws HttpException, UnsupportedOperationException {
> + throws HttpException, UnsupportedOperationException {
> + log.trace("enter Authenticator.authenticate(HttpMethod,
> HttpState)");
>
> - log.debug("enter Authenticator.authenticate(HttpMethod,
> HttpState)");
> - Header challengeHeader =
> method.getResponseHeader(WWW_AUTH);
> -
> - return authenticate(method, state, challengeHeader,
> WWW_AUTH_RESP);
> - }
> + Header challengeHeader =
method.getResponseHeader(WWW_AUTH);
> + return authenticate(method, state, challengeHeader,
> WWW_AUTH_RESP);
> + }
>
> /**
> * Add requisite proxy authentication credentials to the given
> <i>method</i>
> @@ -172,13 +171,12 @@
> * @see #authenticate(HttpMethod,HttpState,Header,String)
> */
> static boolean authenticateProxy(HttpMethod method, HttpState
> state)
> - throws HttpException, UnsupportedOperationException {
> -
> - log.debug("enter
> Authenticator.authenticateProxy(HttpMethod, HttpState)");
> - Header challengeHeader =
> method.getResponseHeader(PROXY_AUTH);
> + throws HttpException, UnsupportedOperationException {
> + log.trace("enter
Authenticator.authenticateProxy(HttpMethod,
> HttpState)");
>
> - return authenticate(method, state, challengeHeader,
> PROXY_AUTH_RESP);
> - }
> + Header challengeHeader =
method.getResponseHeader(PROXY_AUTH);
> + return authenticate(method, state, challengeHeader,
> PROXY_AUTH_RESP);
> + }
>
>
> /**
> @@ -202,8 +200,10 @@
> * @see #digest
> * @see HttpMethod#addRequestHeader
> */
> - private static boolean authenticate(HttpMethod method,
HttpState
> state, Header challengeHeader, String respHeader) throws
HttpException,
> UnsupportedOperationException {
> - log.debug("enter Authenticator.authenticate(HttpMethod,
> HttpState, Header, String)");
> + private static boolean authenticate(HttpMethod method,
HttpState
> state, Header challengeHeader, String respHeader)
> + throws HttpException, UnsupportedOperationException {
> +
> + log.trace("enter Authenticator.authenticate(HttpMethod,
> HttpState, Header, String)");
>
> //check the preemptive policy
> //TODO: this needs to be a service from some configuration
> class
> @@ -296,9 +296,10 @@
> *
> * @throws HttpException when no matching credentials are
available
> */
> - static Header basic(String realm, HttpState state, String
> respHeader) throws HttpException {
> + static Header basic(String realm, HttpState state, String
> respHeader)
> + throws HttpException {
> + log.trace("enter Authenticator.basic(String, HttpState,
> String)");
>
> - log.debug("enter Authenticator.basic(String, HttpState)");
> boolean proxy = PROXY_AUTH_RESP.equals(respHeader);
> UsernamePasswordCredentials cred = null;
> try {
> @@ -320,7 +321,10 @@
> * Return a Basic <tt>Authorization</tt> header value for the
> * given {@link UsernamePasswordCredentials}.
> */
> - static String basic(UsernamePasswordCredentials cred) throws
> HttpException {
> + static String basic(UsernamePasswordCredentials cred)
> + throws HttpException {
> + log.trace("enter
> Authenticator.basic(UsernamePasswordCredentials)");
> +
> String authString = cred.getUserName() + ":" +
> cred.getPassword();
> return "Basic " + new
> String(base64.encode(authString.getBytes()));
> }
> @@ -338,8 +342,10 @@
> *
> * @throws HttpException when no matching credentials are
available
> */
> - static Header digest(String realm, HttpMethod method, HttpState
> state, String respHeader) throws HttpException {
> - log.debug("Authenticator.digest(String,HttpState)");
> + static Header digest(String realm, HttpMethod method, HttpState
> state, String respHeader)
> + throws HttpException {
> + log.trace("enter Authenticator.digest(String, HttpMethod,
> HttpState, String)");
> +
> boolean proxy = PROXY_AUTH_RESP.equals(respHeader);
> UsernamePasswordCredentials cred = null;
> try {
> @@ -377,7 +383,10 @@
> * Return a Digest <tt>Authorization</tt> header value for the
> * given {@link UsernamePasswordCredentials}.
> */
> - static String digest(UsernamePasswordCredentials cred,
Hashtable
> headers) throws HttpException {
> + static String digest(UsernamePasswordCredentials cred,
Hashtable
> headers)
> + throws HttpException {
> + log.trace("enter
> Authenticator.digest(UsernamePasswordCredentials, Hashtable)");
> +
> String digest = createDigest(cred.getUserName(),
> cred.getPassword(), headers);
> return "Digest " + createDigestHeader(cred.getUserName(),
> headers, digest);
> }
> @@ -394,8 +403,11 @@
> * @return The created digest as string. This will be the
response
> tag's
> * value in the Authentication HTTP header.
> */
> - public static String createDigest(String uname, String pwd,
> Hashtable dCreds) throws HttpException {
> - String digAlg = "MD5";
> + public static String createDigest(String uname, String pwd,
> Hashtable dCreds)
> + throws HttpException {
> + log.trace("enter Authenticator.createDigest(String, String,
> Hashtable)");
> +
> + final String digAlg = "MD5";
>
> // Collecting required tokens
> String uri = removeQuotes((String)dCreds.get("uri"));
> @@ -437,8 +449,10 @@
> * @throws AxisFault if MD5 algorithm is not supported.
> */
> private static String createCnonce() throws HttpException {
> + log.trace("enter Authenticator.createCnonce()");
> +
> String cnonce;
> - String digAlg = "MD5";
> + final String digAlg = "MD5";
> MessageDigest md5Helper;
> try {
> md5Helper = MessageDigest.getInstance(digAlg);
> @@ -460,10 +474,12 @@
> * @param uname Username
> * @param dCreds Hashtable containing header information (uri,
> realm,
> * nonce, nc, cnonce, opaque, qop).
> - * @digest The response tag's value as String.
> + * @param digest The response tag's value as String.
> * @return The digest-response as String.
> */
> private static String createDigestHeader(String uname,
Hashtable
> dCreds, String digest) {
> + log.trace("enter Authenticator.createDigestHeader(String,
> Hashtable, String)");
> +
> StringBuffer sb = new StringBuffer();
> String uri = removeQuotes((String)dCreds.get("uri"));
> String realm = removeQuotes((String)dCreds.get("realm"));
> @@ -502,6 +518,8 @@
> * <CODE>str</CODE>
> */
> private static String removeQuotes(String str) {
> + log.trace("enter Authenticator.removeQuotes(String)");
> +
> if (str == null)
> return null;
>
> @@ -522,6 +540,7 @@
> * @return encoded MD5, or <CODE>null</CODE> if encoding failed
> */
> private static String encode( byte[] binaryData ) {
> + log.trace("enter Authenticator.encode(byte[])");
>
> if (binaryData.length != 16)
> return null;
> @@ -555,9 +574,13 @@
> * @return The parameters from www-authenticate header as a
> Hashtable
> */
> private static Hashtable getHTTPDigestCredentials(HttpMethod
> method) {
> + log.trace("enter
> Authenticator.getHTTPDigestCredentials(HttpMethod)");
> +
> String authHeader = method.getResponseHeader("www-
> authenticate").getValue();
> Hashtable ht = new Hashtable(15);
> - if (authHeader == null) return ht;
> + if (authHeader == null) {
> + return ht;
> + }
> authHeader = authHeader.substring(7).trim();
> int i = 0;
> int j = authHeader.indexOf(",");
> @@ -583,6 +606,8 @@
> * entry is placed (only if it has <CODE>"xxx=yyy"</CODE>
> format).
> */
> private static void processDigestToken(String token, Hashtable
ht)
> {
> + log.trace("enter Authenticator.processDigestToken(String,
> Hashtable)");
> +
> int eqpos = token.indexOf("=");
>
> if (eqpos > 0 && eqpos < token.length()-1)
>
>
>
> 1.10 +5 -5 jakarta-
> commons/httpclient/src/java/org/apache/commons/httpclient/Base64.java
>
> Index: Base64.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/Base64.java,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- Base64.java 10 Jul 2002 05:09:16 -0000 1.9
> +++ Base64.java 28 Jul 2002 18:08:57 -0000 1.10
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.2 +22 -10 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.
ja
> va
>
> Index: ConnectMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.
ja
> va,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- ConnectMethod.java 23 Jul 2002 14:38:31 -0000 1.1
> +++ ConnectMethod.java 28 Jul 2002 18:08:57 -0000 1.2
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -80,6 +80,7 @@
> * Create a connect method wrapping the existing method
> */
> public ConnectMethod(HttpMethod method) {
> + log.trace("enter ConnectMethod(HttpMethod)");
> this.method = method;
> }
>
> @@ -87,7 +88,10 @@
> return NAME;
> }
>
> - public int execute(HttpState state, HttpConnection connection)
> throws IOException, HttpException {
> + public int execute(HttpState state, HttpConnection connection)
> + throws IOException, HttpException {
> +
> + log.trace("enter ConnectMethod.execute(HttpState,
> HttpConnection)");
> int code = super.execute(state, connection);
> log.debug("CONNECT status code "+ code);
> if ((code >= 200) && (code < 300)) {
> @@ -100,7 +104,10 @@
> /**
> * Writes a minimal set of headers to the proxy.
> */
> - protected void writeRequestHeaders(HttpState state,
HttpConnection
> conn) throws HttpException, IOException {
> + protected void writeRequestHeaders(HttpState state,
HttpConnection
> conn)
> + throws HttpException, IOException {
> + log.trace("enter
ConnectMethod.writeRequestHeaders(HttpState,
> HttpConnection)");
> +
> if (method instanceof HttpMethodBase) {
> ((HttpMethodBase) method).addRequestHeaders(state,
conn);
> }
> @@ -122,8 +129,13 @@
> conn.printLine(line);
> }
>
> - /** the log for output */
> - static private final Log log =
> LogFactory.getLog(ConnectMethod.class);
> +
> + /** Log object for this class. */
> + private static final Log log =
> LogFactory.getLog(ConnectMethod.class);
> +
> + /** Log for any wire messages. */
> + private static final Log wireLog =
> LogFactory.getLog("httpclient.wirelog");
> +
> /** The wrapped method */
> private HttpMethod method;
> -}
> \ No newline at end of file
> +}
>
>
>
> 1.21 +40 -16 jakarta-
> commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java
>
> Index: Cookie.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java,v
> retrieving revision 1.20
> retrieving revision 1.21
> diff -u -r1.20 -r1.21
> --- Cookie.java 21 Jul 2002 04:12:44 -0000 1.20
> +++ Cookie.java 28 Jul 2002 18:08:57 -0000 1.21
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -123,6 +123,7 @@
> */
> public Cookie(String domain, String name, String value, String
> path, Date expires, boolean secure) {
> super(name, value);
> + log.trace("enter Cookie(String, String, String, String,
Date,
> boolean)");
> this.setPath(path);
> this.setDomain(domain);
> this.setExpiryDate(expires);
> @@ -408,6 +409,7 @@
> * Two cookies are equal if the name, path and domain match.
> */
> public boolean equals(Object obj) {
> + log.trace("enter Cookie.equals(Object)");
> if ((obj != null) && (obj instanceof Cookie)) {
> Cookie that = (Cookie) obj;
> return (null == this.getName() ? null == that.getName()
:
> this.getName().equals(that.getName())) &&
> @@ -447,6 +449,7 @@
> * @param date the time at which the request is submitted
> */
> public boolean matches(String domain, int port, String path,
> boolean secure, Date now) {
> + log.trace("enter Cookie.matches(Strinng, int, String,
boolean,
> Date");
> // FIXME: RFC2109 doesn't consider ports when
> filtering/matching
> // cookies. Quoting from Section 2 - Terminology:
> // The terms request-host and request-URI refer to
> @@ -484,7 +487,8 @@
> * @param path the path to which the request is being submitted
> */
> public boolean matches(String domain, int port, String path,
> boolean secure) {
> - return matches(domain,port,path,secure,new Date());
> + log.trace("enter Cookie.matches(String, int, String,
boolean");
> + return matches(domain, port, path, secure, new Date());
> }
>
> /**
> @@ -497,6 +501,7 @@
> * If no cookies match, returns null.
> */
> public static Header createCookieHeader(String domain, String
path,
> Cookie[] cookies) {
> + log.trace("enter Cookie.createCookieHeader(String, String,
> Cookie[])");
> return
Cookie.createCookieHeader(domain,path,false,cookies);
> }
>
> @@ -510,7 +515,10 @@
> * @exception java.lang.IllegalArgumentException if domain or
path
> is null
> * @deprecated use the version which includes port number and
date
> */
> - public static Header createCookieHeader(String domain, String
path,
> boolean secure, Cookie[] cookies) throws IllegalArgumentException {
> + public static Header createCookieHeader(String domain, String
path,
> boolean secure, Cookie[] cookies)
> + throws IllegalArgumentException {
> + log.trace("enter Cookie.createCookieHeader(String, String,
boolean,
> Cookie[])");
> +
> // Make sure domain isn't null here. Path will be
validated in
> subsequent call to createCookieHeader
> if(domain == null){
> throw new IllegalArgumentException("null domain in
> createCookieHeader.");
> @@ -538,8 +546,10 @@
> * If no cookies match, returns null.
> * @exception java.lang.IllegalArgumentException if domain or
path
> is null
> */
> - public static Header createCookieHeader(String domain, int
port,
> String path, boolean secure, Cookie[] cookies) throws
> IllegalArgumentException {
> - return
Cookie.createCookieHeader(domain,port,path,secure,new
> Date(),cookies);
> + public static Header createCookieHeader(String domain, int
port,
> String path, boolean secure, Cookie[] cookies)
> + throws IllegalArgumentException {
> + log.trace("enter Cookie.createCookieHeader(String, int, String,
> bookean, Cookie[])");
> + return Cookie.createCookieHeader(domain, port, path,
secure,
> new Date(), cookies);
> }
>
> /**
> @@ -552,7 +562,10 @@
> * If no cookies match, returns null.
> * @exception java.lang.IllegalArgumentException if domain or
path
> is null
> */
> - public static Header createCookieHeader(String domain, int
port,
> String path, boolean secure, Date now, Cookie[] cookies) throws
> IllegalArgumentException {
> + public static Header createCookieHeader(String domain, int
port,
> String path, boolean secure, Date now, Cookie[] cookies)
> + throws IllegalArgumentException {
> + log.trace("enter Cookie.createCookieHeader(String, int, String,
> bookean, Date, Cookie[])");
> +
> // Validate the domain and path
> if(domain == null){
> throw new IllegalArgumentException("null domain in
> createCookieHeader.");
> @@ -604,6 +617,8 @@
> * of RFC2109</p>
> */
> public int compare(Object o1, Object o2) {
> + log.trace("enter Cookie.compare(Object, Object)");
> +
> if (!(o1 instanceof Cookie)) {
> throw new ClassCastException(o1.getClass().getName());
> }
> @@ -654,7 +669,9 @@
> * @throws HttpException if an exception occurs during parsing
> * @throws java.lang.IllegalArgumentException if domain or path
are
> null
> */
> - public static Cookie[] parse(String domain, int port, String
path,
> Header setCookie) throws HttpException, IllegalArgumentException {
> + public static Cookie[] parse(String domain, int port, String
path,
> Header setCookie)
> + throws HttpException, IllegalArgumentException {
> + log.trace("enter Cookie.parse(String, int, String, Header)");
> return Cookie.parse(domain,port,path,false,setCookie);
> }
>
> @@ -670,7 +687,9 @@
> * @throws HttpException if an exception occurs during parsing
> * @throws java.lang.IllegalArgumentException if domain or path
are
> null
> */
> - public static Cookie[] parse(String domain, String path, Header
> setCookie) throws HttpException, IllegalArgumentException {
> + public static Cookie[] parse(String domain, String path, Header
> setCookie)
> + throws HttpException, IllegalArgumentException {
> + log.trace("enter Cookie.parse(String, String, Header)");
> return Cookie.parse(domain,80,path,false,setCookie);
> }
>
> @@ -686,7 +705,9 @@
> * @throws HttpException if an exception occurs during parsing
> * @throws java.lang.IllegalArgumentException if domain or path
are
> null
> */
> - public static Cookie[] parse(String domain, String path,
boolean
> secure, Header setCookie) throws HttpException {
> + public static Cookie[] parse(String domain, String path,
boolean
> secure, Header setCookie)
> + throws HttpException {
> + log.trace("enter Cookie.parse(String, String, boolean,
Header)");
> return Cookie.parse(domain,(secure ? 443 :
> 80),path,secure,setCookie);
> }
>
> @@ -718,7 +739,10 @@
> * @throws HttpException if an exception occurs during parsing
> * @throws java.lang.IllegalArgumentException if domain or
path
> are null
> */
> - public static Cookie[] parse(String domain, int port, String
path,
> boolean secure, Header setCookie) throws HttpException,
> IllegalArgumentException {
> + public static Cookie[] parse(String domain, int port, String
path,
> boolean secure, Header setCookie)
> + throws HttpException, IllegalArgumentException {
> + log.trace("enter Cookie.parse(String, int, String, boolean,
> Header)");
> +
> // Validate domain and path
> if(domain == null){
> throw new IllegalArgumentException("domain may not be
> null.");
> @@ -1090,8 +1114,8 @@
> Locale.US);
> }
>
> - /** <tt>org.apache.commons.httpclient.Cookie</tt> log. */
> - private static final Log log =
> LogFactory.getLog(Cookie.class.getName());
> + /** Log object for this class */
> + private static final Log log = LogFactory.getLog(Cookie.class);
>
> }
>
>
>
>
> 1.5 +5 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/Credentials.ja
va
>
> Index: Credentials.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/Credentials.ja
va
> ,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- Credentials.java 5 Jan 2002 11:15:59 -0000 1.4
> +++ Credentials.java 28 Jul 2002 18:08:57 -0000 1.5
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.8 +5 -5 jakarta-
> commons/httpclient/src/java/org/apache/commons/httpclient/Header.java
>
> Index: Header.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/Header.java,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- Header.java 14 Jul 2002 02:31:39 -0000 1.7
> +++ Header.java 28 Jul 2002 18:08:57 -0000 1.8
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.10 +15 -11 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HeaderElement.
ja
> va
>
> Index: HeaderElement.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HeaderElement.
ja
> va,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- HeaderElement.java 21 Jul 2002 04:12:44 -0000 1.9
> +++ HeaderElement.java 28 Jul 2002 18:08:57 -0000 1.10
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -149,8 +149,8 @@
>
> // --------------------------------------------------------
> Constants
>
> - /** <tt>org.apache.commons.httpclient.HeaderElement</tt> log.
*/
> - static private final Log log =
> LogFactory.getLog(HeaderElement.class.getName());
> + /** Log object for this class. */
> + private static final Log log =
> LogFactory.getLog(HeaderElement.class);
>
> /**
> * Map of numeric values to whether or not the
> @@ -254,8 +254,9 @@
> * @throws HttpException if the above syntax rules are
violated.
> */
> public final static HeaderElement[] parse(String headerValue)
> - throws HttpException
> - {
> + throws HttpException {
> + log.trace("enter HeaderElement.parse(String)");
> +
> if (headerValue == null) {
> return null;
> }
> @@ -371,6 +372,8 @@
> * otherwise
> */
> private final static boolean
hasOddNumberOfQuotationMarks(String
> string) {
> + log.trace("enter
> HeaderElement.hasOddNumberOfQuotationMarks(String)");
> +
> boolean odd = false;
> int start = -1;
> while ((start = string.indexOf('"', start+1)) != -1) {
> @@ -387,14 +390,15 @@
> * @param end the end position of the text within the array
> * @return a {@link NameValuePair} representing the header
> */
> - private final static NameValuePair parsePair(char[] header, int
> start,
> - int end) {
> + private final static NameValuePair parsePair(char[] header, int
> start, int end) {
> + log.trace("enter HeaderElement.parsePair(char[], int, int)");
>
> boolean done = false;
> NameValuePair pair = null;
> String name = new String(header, start, end -
start).trim();
> String value = null;
>
> + //TODO: This would certainly benefit from a StringBuffer
> int index = name.indexOf("=");
> if (index >= 0) {
> if ((index + 1) < name.length()) {
>
>
>
> 1.53 +38 -30 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.jav
a
>
> Index: HttpClient.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.jav
a,
> v
> retrieving revision 1.52
> retrieving revision 1.53
> diff -u -r1.52 -r1.53
> --- HttpClient.java 23 Jul 2002 14:38:31 -0000 1.52
> +++ HttpClient.java 28 Jul 2002 18:08:57 -0000 1.53
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -89,7 +89,7 @@
>
> //
--------------------------------------------------------------
> Constants
>
> - /** <tt>org.apache.commons.httpclient.HttpClient</tt> log. */
> + /** Log object for this class. */
> private static final Log log =
LogFactory.getLog(HttpClient.class);
>
> // -----------------------------------------------------------
> Constructors
> @@ -169,6 +169,7 @@
> * @see #endSession()
> */
> public void startSession(String host, int port) {
> + log.trace("enter HttpClient.startSession(String, int)");
> startSession(host, port, false);
> }
>
> @@ -183,6 +184,8 @@
> *
> */
> public void startSession(String host, int port, boolean https)
{
> + log.trace("enter HttpClient.startSession(String, int,
> boolean)");
> +
> if (log.isDebugEnabled()) {
> log.debug("HttpClient.startSession(String,int,boolean):
> Host:"
> + host + " Port:" + port + " HTTPS:" + https);
> @@ -201,6 +204,7 @@
> * @see #endSession()
> */
> public void startSession(String host, int port, Credentials
creds)
> {
> + log.trace("enter HttpClient.startSession(String, int,
> Credentials)");
> startSession(host, port, creds, false);
> }
>
> @@ -216,12 +220,14 @@
> * @param https when <code>true</code>, create an HTTPS session
> * @see #endSession()
> */
> - public void startSession(String host, int port, Credentials
creds,
> - boolean https) {
> + public void startSession(String host, int port, Credentials
creds,
> boolean https) {
> + log.trace("enter HttpClient.startSession(String, int,
> Credentials, boolean)");
> +
> if (log.isDebugEnabled()) {
> log.debug(
> -
> "HttpClient.startSession(String,int,Credentials,boolean): Host:"
> - + host + " Port:" + port + " Credentials:" + creds
> + "Starting HttpClient session"
> + + " Host:" + host
> + + " Port:" + port + " Credentials:" + creds
> + " HTTPS:" + https);
> }
> getState().setCredentials(null, creds);
> @@ -243,16 +249,18 @@
> *
> */
> public void startSession(URL url) {
> - if ("https".equalsIgnoreCase(url.getProtocol())) {
> - startSession(url.getHost(), url.getPort() == -1 ? 443
> - : url.getPort(), true);
> - } else if ("http".equalsIgnoreCase(url.getProtocol())) {
> - startSession(url.getHost(), url.getPort() == -1 ? 80
> - : url.getPort(), false);
> - } else {
> - throw new IllegalArgumentException("Protocol " +
> url.getProtocol()
> - + " not supported in
URL "
> + url);
> - }
> + log.trace("enter HttpClient.startSession(String, int,
> Credentials, boolean)");
> +
> + if ("https".equalsIgnoreCase(url.getProtocol())) {
> + startSession(url.getHost(), url.getPort() == -1 ? 443
> + : url.getPort(), true);
> + } else if ("http".equalsIgnoreCase(url.getProtocol())) {
> + startSession(url.getHost(), url.getPort() == -1 ? 80
> + : url.getPort(), false);
> + } else {
> + throw new IllegalArgumentException("Protocol " +
> url.getProtocol()
> + + " not supported in URL " + url);
> + }
> }
>
> /**
> @@ -271,6 +279,7 @@
> *
> */
> public void startSession(URL url, Credentials creds) {
> + log.trace("enter HttpClient.startSession(URL,
Credentials)");
> getState().setCredentials(null, creds);
> startSession(url);
> }
> @@ -287,8 +296,8 @@
> * @see #endSession()
> *
> */
> - public void startSession(String host, int port,
> - String proxyhost, int proxyport) {
> + public void startSession(String host, int port, String
proxyhost,
> int proxyport) {
> + log.trace("enter HttpClient.startSession(String, int,
String,
> int)");
> startSession(host, port, proxyhost, proxyport, false);
> }
>
> @@ -306,11 +315,9 @@
> * @see #endSession()
> *
> */
> - public void startSession(String host, int port,
> - String proxyhost, int proxyport,
> - boolean secure) {
> - connection = new HttpConnection(proxyhost, proxyport, host,
> port,
> - secure);
> + public void startSession(String host, int port, String
proxyhost,
> int proxyport, boolean secure) {
> + log.trace("enter HttpClient.startSession(String, int,
String,
> int, boolean)");
> + connection = new HttpConnection(proxyhost, proxyport, host,
> port, secure);
> }
>
> /**
> @@ -324,8 +331,9 @@
> * @throws HttpException if a protocol exception occurs
> * @throws IllegalStateException if the session has not been
> started
> */
> - public synchronized int executeMethod(HttpMethod method) throws
> IOException,
> - HttpException, IllegalStateException {
> + public synchronized int executeMethod(HttpMethod method)
> + throws IOException, HttpException, IllegalStateException {
> + log.trace("enter HttpClient.executeMethod(HttpMethod)");
>
> if (null == method) {
> throw new NullPointerException("HttpMethod parameter");
> @@ -361,7 +369,7 @@
> * @throws IOException when i/o errors occur closing the
connection
> */
> public void endSession() throws IOException {
> - log.debug("HttpClient.endSession()");
> + log.trace("enter HttpClient.endSession()");
> if (null != connection) {
> connection.close();
> connection = null;
>
>
>
> 1.13 +82 -68 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection
.j
> ava
>
> Index: HttpConnection.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection
.j
> ava,v
> retrieving revision 1.12
> retrieving revision 1.13
> diff -u -r1.12 -r1.13
> --- HttpConnection.java 23 Jul 2002 14:38:31 -0000 1.12
> +++ HttpConnection.java 28 Jul 2002 18:08:57 -0000 1.13
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -302,8 +302,8 @@
> * protocol, such as a TCP error.
> * @throws IllegalStateException if I am not connected
> */
> - public void setSoTimeout(int timeout) throws SocketException,
> - IllegalStateException {
> + public void setSoTimeout(int timeout)
> + throws SocketException, IllegalStateException {
> log.debug("HttpConnection.setSoTimeout("+ timeout +")");
> _so_timeout = timeout;
> if(_socket != null){
> @@ -318,7 +318,8 @@
> * @throws IOException when there are errors opening the
connection
> */
> public void open() throws IOException {
> - log.debug("HttpConnection.open()");
> + log.trace("enter HttpConnection.open()");
> +
> assertNotOpen(); // ??? is this worth doing?
> try {
> if (null == _socket) {
> @@ -358,8 +359,14 @@
> * @throws IOException if an error occured creating the secure
> socket
> */
> public void tunnelCreated() throws IllegalStateException,
> IOException {
> - if (!isSecure() || !isProxied()) throw new
> IllegalStateException("Connection must be secure and proxied to use
this
> feature");
> - if (_usingSecureSocket) throw new
> IllegalStateException("Already using a secure socket");
> + log.trace("enter HttpConnection.tunnelCreated()");
> +
> + if (!isSecure() || !isProxied()) {
> + throw new IllegalStateException("Connection must be secure
and
> proxied to use this feature");
> + }
> + if (_usingSecureSocket) {
> + throw new IllegalStateException("Already using a secure
> socket");
> + }
>
> if (sslSocketFactory == null) {
> sslSocketFactory = SSLSocketFactory.getDefault();
> @@ -392,9 +399,9 @@
> * @return a stream to write the request to
> */
> public OutputStream getRequestOutputStream() throws
IOException,
> IllegalStateException {
> + log.trace("enter HttpConnection.getRequestOutputStream()");
> assertOpen();
> - RequestOutputStream out = new RequestOutputStream(_output);
> - return out;
> + return new RequestOutputStream(_output);
> }
>
> /**
> @@ -407,10 +414,12 @@
> * @throws IOException if an I/O problem occurs
> * @return a stream to write the request to
> */
> - public OutputStream getRequestOutputStream(boolean useChunking)
> throws IOException, IllegalStateException {
> + public OutputStream getRequestOutputStream(boolean useChunking)
> + throws IOException, IllegalStateException {
> + log.trace("enter
> HttpConnection.getRequestOutputStream(boolean)");
> +
> assertOpen();
> - RequestOutputStream out = new
> RequestOutputStream(_output,useChunking);
> - return out;
> + return new RequestOutputStream(_output, useChunking);
> }
>
> /**
> @@ -429,6 +438,7 @@
> */
> public InputStream getResponseInputStream(HttpMethod method)
> throws IOException, IllegalStateException {
> + log.trace("enter
> HttpConnection.getRequestOutputStream(HttpMethod)");
> assertOpen();
> return new ResponseInputStream(_input,method);
> }
> @@ -442,27 +452,22 @@
> * @throws IllegalStateException if I am not connected
> * @throws IOException if an I/O problem occurs
> */
> - public void write(byte[] data) throws IOException,
> IllegalStateException,
> - HttpRecoverableException {
> - if(log.isDebugEnabled()){
> - log.debug("HttpConnection.write(byte[])");
> - }
> + public void write(byte[] data)
> + throws IOException, IllegalStateException,
HttpRecoverableException
> {
> + log.trace("enter HttpConnection.write(byte[])");
> +
> assertOpen();
> if(wireLog.isInfoEnabled() && (data.length > 0)) {
> wireLog.info(">> \"" + new String(data) + "\"");
> }
> try {
> _output.write(data);
> - } catch(SocketException e){
> - if(log.isDebugEnabled()) {
> - log.debug("HttpConnection: Socket exception while
> writing data",e);
> - }
> - throw new HttpRecoverableException(e.toString());
> - } catch(IOException e) {
> - if(log.isDebugEnabled()) {
> - log.debug("HttpConnection: Exception while writing
> data",e);
> - }
> - throw e;
> + } catch(SocketException se){
> + log.debug("HttpConnection: Socket exception while writing
data",
> se);
> + throw new HttpRecoverableException(se.toString());
> + } catch(IOException ioe) {
> + log.debug("HttpConnection: Exception while writing data",
ioe);
> + throw ioe;
> }
> }
>
> @@ -477,6 +482,7 @@
> * @param len the number of bytes to write.
> */
> public void write(byte[] data, int off, int len) throws
IOException
> {
> + log.trace("enter HttpConnection.write(byte[], int, int)");
> _output.write(data, off, len);
> }
>
> @@ -485,16 +491,14 @@
> * output stream.
> *
> * @param data the bytes to be written
> - * @throws HttpRecoverableException when socket exceptions
occur
> writing
> - * data
> + * @throws HttpRecoverableException when socket exceptions
occur
> writing data
> * @throws IllegalStateException if I am not connected
> * @throws IOException if an I/O problem occurs
> */
> - public void writeLine(byte[] data) throws IOException,
> - IllegalStateException, HttpRecoverableException {
> - if(log.isDebugEnabled()){
> - log.debug("HttpConnection.writeLine(byte[])");
> - }
> + public void writeLine(byte[] data)
> + throws IOException, IllegalStateException,
HttpRecoverableException
> {
> + log.trace("enter HttpConnection.writeLine(byte[])");
> +
> assertOpen();
> if(wireLog.isInfoEnabled() && (data.length > 0)) {
> wireLog.info(">> \"" + new String(data) + "\"");
> @@ -520,21 +524,19 @@
> * @throws IllegalStateException if I am not connected
> * @throws IOException if an I/O problem occurs
> */
> - public void writeLine() throws IOException,
IllegalStateException,
> - HttpRecoverableException {
> - if(log.isDebugEnabled()){
> - log.debug("HttpConnection.writeLine()");
> - }
> + public void writeLine()
> + throws IOException, IllegalStateException,
HttpRecoverableException
> {
> + log.trace("enter HttpConnection.writeLine()");
> +
> wireLog.info(">> \\r\\n");
> try{
> _output.write(CRLF);
> - } catch(SocketException e){
> - if(log.isDebugEnabled()) {
> - log.debug("HttpConnection: Socket exception while
> writing data",e);
> - }
> - throw new HttpRecoverableException(e.toString());
> - } catch(IOException e){
> - throw e;
> + } catch(SocketException se){
> + log.warn("HttpConnection: Socket exception while writing
data",
> se);
> + throw new HttpRecoverableException(se.toString());
> + } catch(IOException ioe){
> + log.warn("HttpConnection: IO exception while writing data",
> ioe);
> + throw ioe;
> }
> }
>
> @@ -547,8 +549,9 @@
> * @throws IllegalStateException if I am not connected
> * @throws IOException if an I/O problem occurs
> */
> - public void print(String data) throws IOException,
> IllegalStateException,
> - HttpRecoverableException {
> + public void print(String data)
> + throws IOException, IllegalStateException,
HttpRecoverableException
> {
> + log.trace("enter HttpConnection.print(String)");
> write(data.getBytes());
> }
>
> @@ -562,8 +565,9 @@
> * @throws IllegalStateException if I am not connected
> * @throws IOException if an I/O problem occurs
> */
> - public void printLine(String data) throws IOException,
> - IllegalStateException, HttpRecoverableException {
> + public void printLine(String data)
> + throws IOException, IllegalStateException,
HttpRecoverableException
> {
> + log.trace("enter HttpConnection.printLine(String)");
> writeLine(data.getBytes());
> }
>
> @@ -577,6 +581,7 @@
> */
> public void printLine() throws IOException,
IllegalStateException,
> HttpRecoverableException {
> + log.trace("enter HttpConnection.printLine()");
> writeLine();
> }
>
> @@ -587,8 +592,10 @@
> * @throws IOException if an I/O problem occurs
> * @return a line from the response
> */
> - public String readLine() throws IOException,
IllegalStateException
> {
> - log.debug("HttpConnection.readLine()");
> + public String readLine()
> + throws IOException, IllegalStateException {
> + log.trace("enter HttpConnection.readLine()");
> +
> assertOpen();
> StringBuffer buf = new StringBuffer();
> for(;;) {
> @@ -618,7 +625,8 @@
> * Shutdown my {@link Socket}'s output, via {@link
> Socket#shutdownOutput}.
> */
> public void shutdownOutput() {
> - log.debug("HttpConnection.shutdownOutput()");
> + log.trace("enter HttpConnection.shutdownOutput()");
> +
> try {
> // Socket.shutdownOutput is a JDK 1.3
> // method. We'll use reflection in case
> @@ -628,7 +636,8 @@
> ("shutdownOutput", paramsClasses);
> Object[] params = new Object[0];
> shutdownOutput.invoke(_socket, params);
> - } catch (Exception e) {
> + } catch (Exception ex) {
> + log.debug("Unexpected Exception caught", ex);
> // Ignore, and hope everything goes right
> }
> // close output stream?
> @@ -638,7 +647,7 @@
> * Close my socket and streams.
> */
> public void close() {
> - log.debug("HttpConnection.close()");
> + log.trace("enter HttpConnection.close()");
> closeSocketAndStreams();
> }
>
> @@ -649,24 +658,27 @@
> * Close everything out.
> */
> protected void closeSocketAndStreams() {
> - log.debug("HttpConnection.closeSocketAndStreams()");
> + log.trace("enter HttpConnection.closeSockedAndStreams()");
> try {
> _input.close();
> - } catch(Exception e) {
> + } catch(Exception ex) {
> + log.debug("Exception caught when closing input", ex);
> // ignored
> }
> _input = null;
>
> try {
> _output.close();
> - } catch(Exception e) {
> + } catch(Exception ex) {
> + log.debug("Exception caught when closing output", ex);
> // ignored
> }
> _output = null;
>
> try {
> _socket.close();
> - } catch(Exception e) {
> + } catch(Exception ex) {
> + log.debug("Exception caught when closing socket", ex);
> // ignored
> }
> _socket = null;
> @@ -680,7 +692,8 @@
> *
> * @throws IllegalStateException if connected
> */
> - protected void assertNotOpen() throws IllegalStateException {
> + protected void assertNotOpen()
> + throws IllegalStateException {
> if(_open) {
> throw new IllegalStateException("Connection is open");
> }
> @@ -691,7 +704,8 @@
> *
> * @throws IllegalStateException if not connected
> */
> - protected void assertOpen() throws IllegalStateException {
> + protected void assertOpen()
> + throws IllegalStateException {
> if(!_open) {
> throw new IllegalStateException("Connection is not
open");
> }
> @@ -699,10 +713,10 @@
>
> //
-------------------------------------------------------------
> Attributes
>
> - /** <tt>org.apache.commons.httpclient.HttpConnection</tt> log.
*/
> - static private final Log log =
> LogFactory.getLog(HttpConnection.class.getName());
> - /** <tt>httpclient.wire</tt> log. */
> - static private final Log wireLog =
> LogFactory.getLog("httpclient.wire");
> + /** Log object for this class. */
> + private static final Log log =
> LogFactory.getLog(HttpConnection.class);
> + /** Log for any wire messages. */
> + private static final Log wireLog =
> LogFactory.getLog("httpclient.wire");
> /** My host. */
> private String _host = null;
> /** My port. */
>
>
>
> 1.9 +34 -31 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection
Ma
> nager.java
>
> Index: HttpConnectionManager.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection
Ma
> nager.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- HttpConnectionManager.java 23 Jul 2002 14:38:31 -0000
1.8
> +++ HttpConnectionManager.java 28 Jul 2002 18:08:57 -0000
1.9
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -79,8 +79,8 @@
> public class HttpConnectionManager
> {
> // --------------------------------------------------------
Class
> Variables
> - private static final Log log = LogFactory.getLog(
> - HttpConnectionManager.class);
> + /** Log object for this class. */
> + private static final Log log =
> LogFactory.getLog(HttpConnectionManager.class);
>
> // -----------------------------------------------------
Instance
> Variables
> private HashMap mapHosts = new HashMap();
> @@ -92,8 +92,7 @@
> /**
> * No-args constructor
> */
> - public HttpConnectionManager()
> - {
> + public HttpConnectionManager() {
> }
>
> /**
> @@ -101,8 +100,7 @@
> *
> * @param proxyHost - the proxy host name
> */
> - public void setProxyHost(String proxyHost)
> - {
> + public void setProxyHost(String proxyHost) {
> this.proxyHost = proxyHost;
> }
>
> @@ -111,8 +109,7 @@
> *
> * @return the proxy host name
> */
> - public String getProxyHost()
> - {
> + public String getProxyHost() {
> return proxyHost;
> }
>
> @@ -121,8 +118,7 @@
> *
> * @param proxyPort - the proxy port number
> */
> - public void setProxyPort(int proxyPort)
> - {
> + public void setProxyPort(int proxyPort) {
> this.proxyPort = proxyPort;
> }
>
> @@ -131,8 +127,7 @@
> *
> * @return the proxy port number
> */
> - public int getProxyPort()
> - {
> + public int getProxyPort() {
> return proxyPort;
> }
>
> @@ -142,8 +137,7 @@
> *
> * @param maxConnections - number of connections allowed for
each
> host:port
> */
> - public void setMaxConnectionsPerHost(int maxConnections)
> - {
> + public void setMaxConnectionsPerHost(int maxConnections) {
> this.maxConnections = maxConnections;
> }
>
> @@ -152,8 +146,7 @@
> *
> * @return The maximum number of connections allowed for a
given
> host:port.
> */
> - public int getMaxConnectionsPerHost()
> - {
> + public int getMaxConnectionsPerHost() {
> return maxConnections;
> }
>
> @@ -168,9 +161,8 @@
> * @exception java.net.MalformedURLException
> * @exception org.apache.commons.HttpException - If no
connection
> becomes availble before the timeout expires
> */
> - public HttpConnection getConnection(String sURL) throws
> HttpException,
> - MalformedURLException
> - {
> + public HttpConnection getConnection(String sURL)
> + throws HttpException, MalformedURLException {
> return getConnection(sURL, 0);
> }
>
> @@ -186,6 +178,8 @@
> * @return the port for the specified port and protocol.
> */
> private static int getPort(String protocol, int port) {
> + log.trace("HttpConnectionManager.getPort(String, port)");
> +
> // default to provided port
> int portForProtocol = port;
> if (portForProtocol == -1) {
> @@ -215,8 +209,9 @@
> * availble before the timeout expires
> */
> public HttpConnection getConnection(String sURL, long timeout)
> - throws HttpException, MalformedURLException
> - {
> + throws HttpException, MalformedURLException {
> + log.trace("enter
HttpConnectionManager.getConnection(String,
> long)");
> +
> // FIXME: This method is too big
> if (sURL == null) {
> throw new MalformedURLException("URL is null");
> @@ -269,6 +264,8 @@
> * @return a pool (list) of connections available for the given
key
> */
> private LinkedList getConnections(String hostAndPort) {
> + log.trace("enter
> HttpConnectionManager.getConnections(String)");
> +
> // Look for a list of connections for the given host:port
> LinkedList listConnections = null;
> synchronized (mapHosts) {
> @@ -290,8 +287,10 @@
> * @return the number of connections in use for the given key
> */
> public Integer getConnectionsInUse(String hostAndPort) {
> + log.trace("enter
> HttpConnectionManager.getConnectionsInUse(String)");
> // FIXME: Shouldn't this be synchronized on
mapNumConnections?
> or
> // mapHosts?
> +
> Integer numConnections =
> (Integer)mapNumConnections.get(hostAndPort);
> if (numConnections == null) {
> log.error("HttpConnectionManager.getConnection: "
> @@ -308,6 +307,8 @@
> */
> private HttpConnection waitForConnection(LinkedList pool, long
> timeout)
> throws HttpException {
> + log.trace("enter
> HttpConnectionManager.waitForConnection(LinkedList, long)");
> +
> // No connections available, so wait
> // Start the timeout thread
> TimeoutThread threadTimeout = new TimeoutThread();
> @@ -340,8 +341,9 @@
> *
> * @param conn - The HttpConnection to make available.
> */
> - public void releaseConnection(HttpConnection conn)
> - {
> + public void releaseConnection(HttpConnection conn) {
> + log.trace("enter
> HttpConnectionManager.releaseConnection(HttpConnection)");
> +
> String host = conn.getHost();
> int port = conn.getPort();
> String key = host + ":" + port;
> @@ -377,8 +379,8 @@
> * an outside mechanism to interrupt the waiting thread after
the
> specified
> * timeout interval.
> */
> - private static class TimeoutThread extends Thread
> - {
> + private static class TimeoutThread extends Thread {
> +
> private long timeout = 0;
> private Thread thrdWakeup = null;
>
> @@ -402,8 +404,8 @@
> return thrdWakeup;
> }
>
> - public void run()
> - {
> + public void run() {
> + log.trace("TimeoutThread.run()");
> if(timeout == 0){
> return;
> }
> @@ -415,6 +417,7 @@
> sleep(timeout);
> thrdWakeup.interrupt();
> }catch(InterruptedException e){
> + log.debug("InterruptedException caught as expected");
> // This is expected
> }
> }
>
>
>
> 1.6 +5 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.
ja
> va
>
> Index: HttpException.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.
ja
> va,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- HttpException.java 5 Jan 2002 11:16:00 -0000 1.5
> +++ HttpException.java 28 Jul 2002 18:08:57 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.14 +5 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.jav
a
>
> Index: HttpMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.jav
a,
> v
> retrieving revision 1.13
> retrieving revision 1.14
> diff -u -r1.13 -r1.14
> --- HttpMethod.java 21 Jul 2002 04:12:45 -0000 1.13
> +++ HttpMethod.java 28 Jul 2002 18:08:57 -0000 1.14
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.38 +94 -61 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase
.j
> ava
>
> Index: HttpMethodBase.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase
.j
> ava,v
> retrieving revision 1.37
> retrieving revision 1.38
> diff -u -r1.37 -r1.38
> --- HttpMethodBase.java 28 Jul 2002 06:24:51 -0000 1.37
> +++ HttpMethodBase.java 28 Jul 2002 18:08:57 -0000 1.38
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -170,8 +170,7 @@
> * NOTE: StrictMode is currently experimental and its
> functionlaity may change in the future.
> *
> */
> - public void setStrictMode(boolean strictMode)
> - {
> + public void setStrictMode(boolean strictMode) {
> this.strictMode = strictMode;
> }
>
> @@ -182,8 +181,7 @@
> *
> * @return true if strict mode is enabled.
> */
> - public boolean isStrictMode()
> - {
> + public boolean isStrictMode() {
> return strictMode;
> }
>
> @@ -249,7 +247,7 @@
> // semantics of the message, by appending each subsequent
> field-value
> // to the first, each separated by a comma."
> // - HTTP/1.0 (4.3)
> - log.debug("HttpMethodBase.addRequestHeader(Header)");
> + log.trace("HttpMethodBase.addRequestHeader(Header)");
>
> if (header == null){
> log.debug("null header value ignored");
> @@ -316,6 +314,8 @@
> * to add as query string parameterss
> */
> public void setQueryString(NameValuePair[] params) {
> + log.trace("enter
> HttpMethodBase.setQueryString(NameValuePair[])");
> +
> StringBuffer buf = new StringBuffer();
> boolean needAmp = false;
> for(int i=0;i<params.length;i++) {
> @@ -439,11 +439,10 @@
> *
> * @return the integer status code if one was obtained, or
<tt>-
> 1</tt>
> */
> - public int execute(HttpState state, HttpConnection connection)
> throws HttpException, IOException {
> + public int execute(HttpState state, HttpConnection connection)
> + throws HttpException, IOException {
> // FIXME: This method is too large
> - if (log.isDebugEnabled()) {
> - log.debug("enter HttpMethodBase.execute(HttpState,
> HttpConnection)");
> - }
> + log.trace("enter HttpMethodBase.execute(HttpState,
> HttpConnection)");
>
> if (null == state) {
> throw new NullPointerException("HttpState parameter");
> @@ -747,10 +746,10 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} to write the request
to
> */
> - protected void writeRequest(HttpState state, HttpConnection
conn)
> throws IOException, HttpException {
> - if (log.isDebugEnabled()) {
> -
>
log.debug("HttpMethodBase.writeRequest(HttpState,HttpConnection)");
> - }
> + protected void writeRequest(HttpState state, HttpConnection
conn)
> + throws IOException, HttpException {
> + log.trace("enter HttpMethodBase.writeRequest(HttpState,
> HttpConnection)");
> +
> writeRequestLine(state,conn);
> writeRequestHeaders(state,conn);
> conn.writeLine(); // close head
> @@ -769,11 +768,12 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} to write to
> */
> - protected void writeRequestLine(HttpState state, HttpConnection
> conn) throws IOException, HttpException {
> - if (log.isDebugEnabled()) {
> -
>
log.debug("HttpMethodBase.writeRequestLine(HttpState,HttpConnection)
> ");
> - }
> - String requestLine =
HttpMethodBase.generateRequestLine(conn,
> getName(),getPath(),getQueryString(),(http11 ? "HTTP/1.1" :
"HTTP/1.0"));
> + protected void writeRequestLine(HttpState state, HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter HttpMethodBase.writeRequestLine(HttpState,
> HttpConnection)");
> +
> + String requestLine =
HttpMethodBase.generateRequestLine(conn,
> getName(), getPath(),
> + getQueryString(),(http11 ? "HTTP/1.1" : "HTTP/1.0"));
> conn.print(requestLine);
> }
>
> @@ -793,10 +793,10 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} to write to
> */
> - protected void writeRequestHeaders(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> - if (log.isDebugEnabled()) {
> -
>
log.debug("HttpMethodBase.writeRequestHeaders(HttpState,HttpConnecti
> on)");
> - }
> + protected void writeRequestHeaders(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter
HttpMethodBase.writeRequestHeaders(HttpState,
> HttpConnection)");
> +
> addRequestHeaders(state,conn);
> Iterator it = requestHeaders.values().iterator();
> while(it.hasNext()) {
> @@ -824,7 +824,10 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} the headers will
> eventually be written to
> */
> - protected void addRequestHeaders(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> + protected void addRequestHeaders(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter
HttpMethodBase.addRequestHeaders(HttpState,
> HttpConnection)");
> +
> addUserAgentRequestHeader(state,conn);
> addHostRequestHeader(state,conn);
> addCookieRequestHeader(state,conn);
> @@ -838,7 +841,10 @@
> * as long as no <tt>User-Agent</tt> request header
> * already exists.
> */
> - protected void addUserAgentRequestHeader(HttpState state,
> HttpConnection conn) throws IOException, HttpException {
> + protected void addUserAgentRequestHeader(HttpState state,
> HttpConnection conn)
> + throws IOException, HttpException {
> + log.trace("enter
> HttpMethodBase.addUserAgentRequestHeaders(HttpState,
HttpConnection)");
> +
> if (!requestHeaders.containsKey("user-agent")) {
> setRequestHeader(HttpMethodBase.USER_AGENT);
> }
> @@ -849,7 +855,10 @@
> * as long as no <tt>Host</tt> request header
> * already exists.
> */
> - protected void addHostRequestHeader(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> + protected void addHostRequestHeader(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter
> HttpMethodBase.addUserAgentRequestHeaders(HttpState,
HttpConnection)");
> +
> // Per 19.6.1.1 of RFC 2616, it is legal for HTTP/1.0 based
> // applications to send the Host request-header.
> // TODO: Add the ability to disable the sending of this
header
> for HTTP/1.0 requests.
> @@ -873,8 +882,12 @@
> /**
> * Adds a <tt>Cookie</tt> request containing the matching
{@link
> Cookie}s.
> */
> - protected void addCookieRequestHeader(HttpState state,
> HttpConnection conn) throws IOException, HttpException {
> - Header cookieHeader =
Cookie.createCookieHeader(conn.getHost(),
> conn.getPort(), getPath(), conn.isSecure(), new Date(),
> state.getCookies());
> + protected void addCookieRequestHeader(HttpState state,
> HttpConnection conn)
> + throws IOException, HttpException {
> + log.trace("enter
> HttpMethodBase.addCookieRequestHeaders(HttpState, HttpConnection)");
> +
> + Header cookieHeader =
Cookie.createCookieHeader(conn.getHost(),
> conn.getPort(),
> + getPath(), conn.isSecure(), new Date(),
state.getCookies());
> if(null != cookieHeader) {
> setRequestHeader(cookieHeader);
> }
> @@ -885,7 +898,10 @@
> * as long as no <tt>Authorization</tt> request header
> * already exists.
> */
> - protected void addAuthorizationRequestHeader(HttpState state,
> HttpConnection conn) throws IOException, HttpException {
> + protected void addAuthorizationRequestHeader(HttpState state,
> HttpConnection conn)
> + throws IOException, HttpException {
> + log.trace("enter
> HttpMethodBase.addAuthorizationRequestHeader(HttpState,
HttpConnection)");
> +
> // add authorization header, if needed
> if
>
(!requestHeaders.containsKey(Authenticator.WWW_AUTH_RESP.toLowerCase()))
{
> Header wwwAuthenticateHeader =
> (Header)(responseHeaders.get(Authenticator.WWW_AUTH.toLowerCase()));
> @@ -904,8 +920,11 @@
> * as long as no <tt>Proxy-Authorization</tt> request header
> * already exists.
> */
> - protected void addProxyAuthorizationRequestHeader(HttpState
state,
> HttpConnection conn) throws IOException, HttpException {
> - // add authorization header, if needed
> + protected void addProxyAuthorizationRequestHeader(HttpState
state,
> HttpConnection conn)
> + throws IOException, HttpException {
> + log.trace("enter
> HttpMethodBase.addProxyAuthorizationRequestHeader(HttpState,
> HttpConnection)");
> +
> + // add proxy authorization header, if needed
> if
>
(!requestHeaders.containsKey(Authenticator.PROXY_AUTH_RESP.toLowerCase()
))
> {
> Header wwwAuthenticateHeader =
> (Header)(responseHeaders.get(Authenticator.PROXY_AUTH.toLowerCase()));
> if (null != wwwAuthenticateHeader) {
> @@ -924,7 +943,10 @@
> * as long as no <tt>Content-Length</tt> request header
> * already exists.
> */
> - protected void addContentLengthRequestHeader(HttpState state,
> HttpConnection conn) throws IOException, HttpException {
> + protected void addContentLengthRequestHeader(HttpState state,
> HttpConnection conn)
> + throws IOException, HttpException {
> + log.trace("enter
> HttpMethodBase.addProxyAuthorizationRequestHeader(HttpState,
> HttpConnection)");
> +
> // add content length or chunking
> int len = getRequestContentLength();
> if (!requestHeaders.containsKey("content-length")) {
> @@ -969,7 +991,8 @@
> * This implementation writes nothing and returns
<tt>true</tt>.
> * @return <tt>true</tt>
> */
> - protected boolean writeRequestBody(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> + protected boolean writeRequestBody(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> return true;
> }
>
> @@ -1010,10 +1033,10 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} to read the response
from
> */
> - protected void readResponse(HttpState state, HttpConnection
conn)
> throws IOException, HttpException {
> - if (log.isDebugEnabled()) {
> -
>
log.debug("HttpMethodBase.readResponse(HttpState,HttpConnection)");
> - }
> + protected void readResponse(HttpState state, HttpConnection
conn)
> + throws IOException, HttpException {
> + log.debug("enter HttpMethodBase.readResponse(HttpState,
> HttpConnection)");
> +
> readStatusLine(state,conn);
> processStatusLine(state,conn);
> readResponseHeaders(state,conn);
> @@ -1036,10 +1059,10 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} to read the response
from
> */
> - protected void readStatusLine(HttpState state, HttpConnection
conn)
> throws IOException, HttpException {
> - if (log.isDebugEnabled()) {
> -
>
log.debug("HttpMethodBase.readStatusLine(HttpState,HttpConnection)")
> ;
> - }
> + protected void readStatusLine(HttpState state, HttpConnection
conn)
> + throws IOException, HttpException {
> + log.trace("enter HttpMethodBase.readStatusLine(HttpState,
> HttpConnection)");
> +
> statusCode = -1;
> statusText = null;
>
> @@ -1116,16 +1139,15 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} to read the response
from
> */
> - protected void readResponseHeaders(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> + protected void readResponseHeaders(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> // "It must be possible to combine the multiple header
fields
> into
> // one "field-name: field-value" pair, without changing the
> // semantics of the message, by appending each subsequent
> field-value
> // to the first, each separated by a comma."
> // - HTTP/1.0 (4.3)
>
> - if (log.isDebugEnabled()) {
> -
>
log.debug("HttpMethodBase.readResponseHeaders(HttpState,HttpConnecti
> on)");
> - }
> + log.trace("enter
HttpMethodBase.readResponseHeaders(HttpState,
> HttpConnection)");
> responseHeaders.clear();
>
> String name = null;
> @@ -1206,6 +1228,8 @@
> * @param conn the {@link HttpConnection} to read the response
from
> */
> protected void processResponseHeaders(HttpState state,
> HttpConnection conn) {
> + log.trace("enter
> HttpMethodBase.processResponseHeaders(HttpState, HttpConnection)");
> +
> // add cookies, if any
> // should we set cookies?
> Header setCookieHeader = getResponseHeader("set-cookie2");
> @@ -1217,8 +1241,8 @@
> try {
> Cookie[] cookies = Cookie.parse(conn.getHost(),
> conn.getPort(), getPath(), conn.isSecure(), setCookieHeader);
> state.addCookies(cookies);
> - } catch (Exception e) {
> -
> log.error("processResponseHeaders(HttpState,HttpConnection)",e);
> + } catch (Exception ex) {
> + log.error("Exception caught when processing
cookies",
> ex);
> }
> }
> }
> @@ -1241,7 +1265,10 @@
> * @param state the client state
> * @param conn the {@link HttpConnection} to read the response
from
> */
> - protected void readResponseBody(HttpState state, HttpConnection
> conn) throws IOException, HttpException {
> + protected void readResponseBody(HttpState state, HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter HttpMethodBase.readResponseBody(HttpState,
> HttpConnection)");
> +
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> readResponseBody(state, conn, out);
>
> @@ -1267,10 +1294,9 @@
> * @param conn the {@link HttpConnection} to read the response
from
> * @param out OutputStream to write the response body to
> */
> - protected void readResponseBody(HttpState state, HttpConnection
> conn, OutputStream out) throws IOException {
> - if (log.isDebugEnabled()) {
> -
>
log.debug("HttpMethodBase.readResponseBody(HttpState,HttpConnection)
> ");
> - }
> + protected void readResponseBody(HttpState state, HttpConnection
> conn, OutputStream out)
> + throws IOException {
> + log.trace("enter HttpMethodBase.readResponseBody(HttpState,
> HttpConnection)");
>
> responseBody = null;
> int expectedLength = 0;
> @@ -1351,6 +1377,8 @@
> * once this method has been called.
> */
> public void recycle() {
> + log.trace("enter HttpMethodBase.recycle()");
> +
> path = null;
> followRedirects = false;
> queryString = null;
> @@ -1409,6 +1437,8 @@
> * the specified attributes.
> */
> protected static String generateRequestLine(HttpConnection
> connection, String name, String reqPath, String qString, String
protocol)
> {
> + log.trace("enter
> HttpMethodBase.generateRequestLine(HttpConnection, String, String,
String,
> String)");
> +
> StringBuffer buf = new StringBuffer();
> buf.append(null == reqPath ? "/" :
> URIUtil.encode(reqPath,URIUtil.pathSafe()));
> if (null != qString) {
> @@ -1450,8 +1480,9 @@
> * @param status - the HTTP status code
> * @return true if the message may contain a body, false if it
can
> not contain a message body
> */
> - private static boolean canResponseHaveBody(int status)
> - {
> + private static boolean canResponseHaveBody(int status) {
> + log.trace("enter HttpMethodBase.canResponseHaveBody(int)");
> +
> boolean result = true;
>
> if((status >= 100 && status <= 199) || // 1XX
> @@ -1471,6 +1502,8 @@
> *
> */
> private static boolean isIpAddress(String value) {
> + log.trace("enter HttpMethodBase.isIpAddress(String)");
> +
> value = value.trim();
>
> // prevent input values of 127.0.0.1. or .127.0.0.1, etc.
> @@ -1528,10 +1561,10 @@
>
> //
--------------------------------------------------------------
> Constants
>
> - /** <tt>org.apache.commons.httpclient.HttpMethod</tt> log. */
> - private static final Log log =
> LogFactory.getLog(HttpMethod.class.getName());
> + /** Log object for this class. */
> + private static final Log log =
LogFactory.getLog(HttpMethod.class);
>
> - /** <tt>httpclient.wire</tt> log. */
> + /** Log for any wire messages. */
> private static final Log wireLog =
> LogFactory.getLog("httpclient.wire");
>
> /** <tt>User-Agent: Jakarta HTTP Client/1.0</tt> header. */
>
>
>
> 1.13 +7 -6 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpMultiClien
t.
> java
>
> Index: HttpMultiClient.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpMultiClien
t.
> java,v
> retrieving revision 1.12
> retrieving revision 1.13
> diff -u -r1.12 -r1.13
> --- HttpMultiClient.java 28 Jul 2002 06:23:06 -0000 1.12
> +++ HttpMultiClient.java 28 Jul 2002 18:08:57 -0000 1.13
> @@ -84,7 +84,7 @@
>
> // --------------------------------------------------------
Class
> Variables
>
> - /** logging output */
> + /** Log object for this class. */
> private static final Log log =
> LogFactory.getLog(HttpMultiClient.class);
>
> // -----------------------------------------------------
Instance
> Variables
> @@ -285,8 +285,9 @@
> * @throws HttpException if a protocol exception occurs
> *
> */
> - public int executeMethod(HttpUrlMethod method) throws
IOException,
> - HttpException {
> + public int executeMethod(HttpUrlMethod method)
> + throws IOException, HttpException {
> + log.trace("enter executeMethod(HttpUrlMethod)");
>
> if (null == method) {
> throw new NullPointerException("method parameter");
>
>
>
> 1.2 +5 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverabl
eE
> xception.java
>
> Index: HttpRecoverableException.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverabl
eE
> xception.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- HttpRecoverableException.java 22 Feb 2002 19:24:23 -0000
1.1
> +++ HttpRecoverableException.java 28 Jul 2002 18:08:57 -0000
1.2
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.4 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpSharedStat
e.
> java
>
> Index: HttpSharedState.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpSharedStat
e.
> java,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- HttpSharedState.java 28 Jul 2002 11:42:05 -0000 1.3
> +++ HttpSharedState.java 28 Jul 2002 18:08:57 -0000 1.4
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.9 +27 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java
>
> Index: HttpState.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java
,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- HttpState.java 21 Jul 2002 04:12:45 -0000 1.8
> +++ HttpState.java 28 Jul 2002 18:08:57 -0000 1.9
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -67,6 +67,9 @@
> import java.util.HashMap;
> import java.util.Iterator;
>
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +
> /**
> * <p>
> * A container for HTTP attributes that may persist from request
> @@ -97,6 +100,11 @@
> */
> private ArrayList cookies = new ArrayList();
>
> + // --------------------------------------------------------
Class
> Variables
> +
> + /** Log object for this class. */
> + public static final Log log =
LogFactory.getLog(HttpState.class);
> +
> //
-------------------------------------------------------------
> Properties
>
> /**
> @@ -106,6 +114,8 @@
> * @param cookie the {@link Cookie} to add
> */
> public void addCookie(Cookie cookie) {
> + log.trace("enter HttpState.addCookie(Cookie)");
> +
> if (cookie != null) {
> // first remove any old cookie that is equivalent
> for (Iterator it = cookies.iterator();it.hasNext(); ) {
> @@ -128,6 +138,8 @@
> * @param newcookies the {@link Cookie}s to add
> */
> public void addCookies(Cookie[] newcookies) {
> + log.trace("enter HttpState.addCookies(Cookie[])");
> +
> if (newcookies != null) {
> for (int i = 0; i < newcookies.length; i++) {
> this.addCookie(newcookies[i]);
> @@ -140,6 +152,7 @@
> * @return an array of my {@link Cookie}s.
> */
> public Cookie[] getCookies() {
> + log.trace("enter HttpState.getCookies()");
> return (Cookie[])(cookies.toArray(new
Cookie[cookies.size()]));
> }
>
> @@ -155,6 +168,8 @@
> * @see Cookie#matches
> */
> public Cookie[] getCookies(String domain, int port, String
path,
> boolean secure, Date now) {
> + log.trace("enter HttpState.getCookies(String, int, String,
> boolean, Date)");
> +
> ArrayList list = new ArrayList(cookies.size());
> for(int i=0,m=cookies.size();i<m;i++) {
> Cookie c = (Cookie)(cookies.get(i));
> @@ -173,6 +188,7 @@
> * @see #purgeExpiredCookies(java.util.Date)
> */
> public boolean purgeExpiredCookies() {
> + log.trace("enter HttpState.purgeExpiredCookies()");
> return purgeExpiredCookies(new Date());
> }
>
> @@ -182,6 +198,7 @@
> * @see Cookie#isExpired(java.util.Date)
> */
> public boolean purgeExpiredCookies(Date date) {
> + log.trace("enter HttpState.purgeExpiredCookies(Date)");
> boolean removed = false;
> Iterator it = cookies.iterator();
> while(it.hasNext()) {
> @@ -209,6 +226,7 @@
> * @param credentials the authentication credentials for the
given
> realm
> */
> public void setCredentials(String realm, Credentials
credentials) {
> + log.trace("enter HttpState.setCredentials(String,
> Credentials)");
> credMap.put(realm,credentials);
> }
>
> @@ -225,6 +243,8 @@
> * @see #setCredentials
> */
> public Credentials getCredentials(String realm) {
> + log.trace("enter HttpState.getCredentials(String)");
> +
> Credentials creds = (Credentials) credMap.get(realm);
> if (creds == null) {
> creds = (Credentials) credMap.get(null);
> @@ -249,6 +269,7 @@
> * @param credentials the authentication credentials for the
given
> realm
> */
> public void setProxyCredentials(String realm, Credentials
> credentials) {
> + log.trace("enter HttpState.setProxyCredentials(String,
> credentials)");
> proxyCred.put(realm, credentials);
> }
>
> @@ -265,6 +286,7 @@
> * @see #setProxyCredentials
> */
> public Credentials getProxyCredentials(String realm) {
> + log.trace("enter HttpState.getProxyCredentials(String)");
> Credentials creds = (Credentials) proxyCred.get(realm);
> if (creds == null) {
> creds = (Credentials) proxyCred.get(null);
>
>
>
> 1.7 +15 -8 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpStatus.jav
a
>
> Index: HttpStatus.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpStatus.jav
a,
> v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -u -r1.6 -r1.7
> --- HttpStatus.java 4 Mar 2002 03:24:50 -0000 1.6
> +++ HttpStatus.java 28 Jul 2002 18:08:57 -0000 1.7
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -64,6 +64,9 @@
>
> import java.util.Hashtable;
>
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.commons.logging.Log;
> +
> /**
> * <p>Constants enumerating the HTTP status codes.</p>
> * @version $Id$
> @@ -71,11 +74,14 @@
> public class HttpStatus {
>
>
> - //
--------------------------------------------------------------
> Variables
> + // --------------------------------------------------------
Class
> Variables
>
> /** Reason phrases (as Strings), by status code (as Integer).
*/
> private static Hashtable mapStatusCodes = new Hashtable();
>
> + /** Log object for this class. */
> + private static final Log log =
LogFactory.getLog(HttpStatus.class);
> +
>
> // ---------------------------------------------------------
Public
> Methods
>
> @@ -87,10 +93,11 @@
> * @return the reason phrase associated with the given status
code
> */
> public static String getStatusText(int nHttpStatusCode) {
> - Integer intKey = new Integer(nHttpStatusCode);
> + log.trace("enter HttpStatus.getStatusText(int)");
>
> + Integer intKey = new Integer(nHttpStatusCode);
> if (!mapStatusCodes.containsKey(intKey)) {
> - // No information
> + log.warn("No status text available for status code " +
> nHttpStatusCode);
> return null;
>
> } else {
>
>
>
> 1.3 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.
ja
> va
>
> Index: HttpUrlMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.
ja
> va,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- HttpUrlMethod.java 28 Mar 2002 03:53:13 -0000 1.2
> +++ HttpUrlMethod.java 28 Jul 2002 18:08:57 -0000 1.3
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.8 +5 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/NameValuePair.
ja
> va
>
> Index: NameValuePair.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/NameValuePair.
ja
> va,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- NameValuePair.java 5 Jan 2002 11:16:00 -0000 1.7
> +++ NameValuePair.java 28 Jul 2002 18:08:57 -0000 1.8
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.11 +29 -17 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputS
tr
> eam.java
>
> Index: RequestOutputStream.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputS
tr
> eam.java,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -r1.10 -r1.11
> --- RequestOutputStream.java 21 Jul 2002 04:12:45 -0000
1.10
> +++ RequestOutputStream.java 28 Jul 2002 18:08:57 -0000
1.11
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -114,6 +114,10 @@
>
> // -------------------------------------------------------
Static
> Variables
>
> + /** Log object for this class. */
> + static private final Log log =
> LogFactory.getLog(RequestOutputStream.class);
> +
> + /** Log for any wire messages. */
> static private final Log wireLog =
> LogFactory.getLog("httpclient.wire");
>
> // -----------------------------------------------------
Instance
> Variables
> @@ -195,6 +199,8 @@
> * @exception IOException if an input or output exception
> occurred
> */
> public void print(String s) throws IOException {
> + log.trace("enter RequestOutputStream.print(String)");
> +
> if (s == null) {
> s = "null";
> }
> @@ -236,6 +242,8 @@
> * @exception IOException if an input/output error occurs
> */
> public void write(int b) throws IOException {
> +
> + //TODO: If using chunking, the chunks are one byte long!
> if (useChunking) {
> stream.write(one, 0, one.length);
> stream.write(crlf, 0, crlf.length);
> @@ -257,6 +265,8 @@
> * Write the specified byte array.
> */
> public void write(byte[] b, int off, int len) throws
IOException {
> + log.trace("enter RequestOutputStream.write(byte[], int,
int)");
> +
> if (useChunking) {
> byte chunkHeader[] =
> (Integer.toHexString(len) + "\r\n").getBytes();
> @@ -280,21 +290,23 @@
> * any further output data to throw an IOException.
> */
> public void close() throws IOException {
> + log.trace("enter RequestOutputStream.close()");
>
> if (this.closed == false) {
> try {
> - if (useChunking) {
> - // Write the final chunk.
> - stream.write(zero, 0,
zero.length);
> - stream.write(crlf, 0,
crlf.length);
> - stream.write(endChunk, 0,
endChunk.length);
> - if(wireLog.isInfoEnabled()) {
> - wireLog.info(">> byte 0
\\r\\n\\r\\n
> (final chunk)");
> - }
> - }
> - super.close();
> - } catch (java.io.IOException ex) {
> - throw ex;
> + if (useChunking) {
> + // Write the final chunk.
> + stream.write(zero, 0, zero.length);
> + stream.write(crlf, 0, crlf.length);
> + stream.write(endChunk, 0, endChunk.length);
> + if(wireLog.isInfoEnabled()) {
> + wireLog.info(">> byte 0 \\r\\n\\r\\n (final
chunk)");
> + }
> + }
> + super.close();
> + } catch (IOException ioe) {
> + log.debug("Unexpected exception caught when closing
output
> stream", ioe);
> + throw ioe;
> } finally {
> this.closed = true;
> }
>
>
>
> 1.16 +33 -13 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputS
tr
> eam.java
>
> Index: ResponseInputStream.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputS
tr
> eam.java,v
> retrieving revision 1.15
> retrieving revision 1.16
> diff -u -r1.15 -r1.16
> --- ResponseInputStream.java 21 Jul 2002 04:12:45 -0000
1.15
> +++ ResponseInputStream.java 28 Jul 2002 18:08:57 -0000
1.16
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -65,6 +65,8 @@
> import java.io.IOException;
> import java.io.InputStream;
>
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.commons.logging.Log;
> /**
> * <p>{@link InputStream} wrapper supporting the chunked transfer
> encoding.</p>
> *
> @@ -78,6 +80,15 @@
> */
> public class ResponseInputStream extends InputStream {
>
> + // --------------------------------------------------------
Class
> Variables
> +
> + /** Log object for this class. */
> + public static final Log log =
> LogFactory.getLog(ResponseInputStream.class);
> +
> + /** Log for wire messages. */
> + public static final Log wireLog =
> LogFactory.getLog("httpclient.wire");
> +
> +
> // -----------------------------------------------------------
> Constructors
>
> /**
> @@ -88,6 +99,8 @@
> *
> */
> public ResponseInputStream(InputStream stream, boolean chunked,
int
> contentLength) {
> + log.trace("enter ResponseInputStream(InputStream, boolean,
> int)");
> +
> if (null == stream) {
> throw new NullPointerException("InputStream parameter
is
> null");
> }
> @@ -107,6 +120,7 @@
> */
> public ResponseInputStream(InputStream stream, HttpMethod
method) {
> super();
> + log.trace("enter ResponseInputStream(InputStream,
> HttpMethod)");
>
> if (null == stream) {
> throw new NullPointerException("InputStream parameter
is
> null");
> @@ -198,15 +212,16 @@
> * If a content length has been set but not all of the bytes
have
> yet been
> * consumed, the remaining bytes will be swallowed.
> */
> - public void close()
> - throws IOException {
> -/*
> + public void close() throws IOException {
> + log.trace("enter ResponseInputStream.close()");
> + /*
> // Xerces appears to doubly-close the input stream...
> if(closed) {
> throw new IOException("Stream is already closed");
> }
> -*/
> + */
>
> + //TODO: This close code is not very robust
> if (!closed) {
> try {
> if (chunk) {
> @@ -248,7 +263,9 @@
> *
> * @exception IOException if an input/output error occurs
> */
> - public int read(byte b[], int off, int len) throws IOException
{
> + public int read(byte b[], int off, int len)
> + throws IOException {
> + log.trace("enter ResponseInputStream.read(byte, int,
int)");
>
> int avail = length - pos;
> if ((avail == 0) && (!fillBuffer()))
> @@ -269,7 +286,6 @@
> System.arraycopy(buffer, pos, b, off, toCopy);
> pos += toCopy;
> return toCopy;
> -
> }
>
> /**
> @@ -279,7 +295,8 @@
> * @exception IOException if an input/output error occurs
> */
> public int read()
> - throws IOException {
> + throws IOException {
> + log.trace("enter ResponseInputStream.read()");
>
> if (pos == length) {
> if (!fillBuffer())
> @@ -297,6 +314,7 @@
> * Fill the chunk buffer.
> */
> private boolean fillBuffer() throws IOException {
> + log.trace("enter ResponseInputStream.fillBuffer()");
>
> // Has this stream been closed?
> if (closed)
> @@ -400,8 +418,10 @@
> * @exception IOException if an input or output exception has
> occurred
> */
> private String readLineFromStream()
> - throws IOException {
> + throws IOException {
> + log.trace("enter
ResponseInputStream.ReadLineFromStream()");
>
> + //TODO: Reformat this code
> StringBuffer sb = new StringBuffer();
> while (true) {
> int ch = stream.read();
>
>
>
> 1.9 +5 -5 jakarta-
> commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java
>
> Index: URIUtil.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- URIUtil.java 22 Jul 2002 15:35:12 -0000 1.8
> +++ URIUtil.java 28 Jul 2002 18:08:57 -0000 1.9
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.5 +5 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/UsernamePasswo
rd
> Credentials.java
>
> Index: UsernamePasswordCredentials.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/UsernamePasswo
rd
> Credentials.java,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- UsernamePasswordCredentials.java 5 Jan 2002 11:16:00
-0000
> 1.4
> +++ UsernamePasswordCredentials.java 28 Jul 2002 18:08:57
-0000
> 1.5
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 1.6 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/Delete
Me
> thod.java
>
> Index: DeleteMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/Delete
Me
> thod.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- DeleteMethod.java 21 Jul 2002 04:12:46 -0000 1.5
> +++ DeleteMethod.java 28 Jul 2002 18:08:58 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.13 +25 -10 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMet
ho
> d.java
>
> Index: GetMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMet
ho
> d.java,v
> retrieving revision 1.12
> retrieving revision 1.13
> diff -u -r1.12 -r1.13
> --- GetMethod.java 23 Jul 2002 14:38:31 -0000 1.12
> +++ GetMethod.java 28 Jul 2002 18:08:59 -0000 1.13
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -91,10 +91,10 @@
>
> //
--------------------------------------------------------------
> Constants
>
> - /** <tt>org.apache.commons.httpclient.methods.GetMethod</tt>
log.
> */
> - private static final Log log =
> LogFactory.getLog(GetMethod.class.getName());
> + /** Log object for this class. */
> + private static final Log log =
LogFactory.getLog(GetMethod.class);
>
> - /** <tt>httpclient.wire</tt> log. */
> + /** Log for any wire messages. */
> private static final Log wireLog =
> LogFactory.getLog("httpclient.wire");
>
> /** Temporary directory. */
> @@ -117,6 +117,7 @@
> */
> public GetMethod(String path) {
> super(path);
> + log.trace("enter GetMethod(String)");
> setFollowRedirects(true);
> }
>
> @@ -128,6 +129,7 @@
> */
> public GetMethod(String path, String tempDir) {
> super(path);
> + log.trace("enter GetMethod(String, String)");
> setUseDisk(true);
> setTempDir(tempDir);
> setFollowRedirects(true);
> @@ -141,6 +143,7 @@
> */
> public GetMethod(String path, String tempDir, String tempFile)
{
> super(path);
> + log.trace("enter GetMethod(String, String, String)");
> setUseDisk(true);
> setTempDir(tempDir);
> setTempFile(tempFile);
> @@ -154,6 +157,7 @@
> */
> public GetMethod(String path, File fileData) {
> this(path);
> + log.trace("enter GetMethod(String, File)");
> useDisk = true;
> this.fileData = fileData;
> setFollowRedirects(true);
> @@ -285,6 +289,8 @@
>
> // override recycle to reset redirects default
> public void recycle() {
> + log.trace("enter GetMethod.recycle()");
> +
> super.recycle();
> this.memoryData = null;
> this.fileData = null;
> @@ -297,6 +303,8 @@
> * Otherwise return <tt>null</tt>.
> */
> public byte[] getResponseBody() {
> + log.trace("enter GetMethod.getResponseBody()");
> +
> checkUsed();
> if(useDisk) {
> try {
> @@ -327,6 +335,8 @@
> * Otherwise return <tt>null</tt>.
> */
> public String getResponseBodyAsString() {
> + log.trace("enter GetMethod.getResponseBodyAsString()");
> +
> byte[] data = getResponseBody();
> if(null == data) {
> return null;
> @@ -341,7 +351,10 @@
> * as an {@link InputStream}.
> * Otherwise return <tt>null</tt>.
> */
> - public InputStream getResponseBodyAsStream() throws IOException
{
> + public InputStream getResponseBodyAsStream()
> + throws IOException {
> + log.trace("enter GetMethod.getResponseBodyAsStream()");
> +
> checkUsed();
> if (useDisk) {
> return new FileInputStream(fileData);
> @@ -361,8 +374,10 @@
> * Overrides method in {@link HttpMethodBase} to
> * write data to the appropriate buffer.
> */
> - protected void readResponseBody(HttpState state, HttpConnection
> conn) throws IOException {
> -
> log.debug("GetMethod.readResponseBody(HttpState,HttpConnection)");
> + protected void readResponseBody(HttpState state, HttpConnection
> conn)
> + throws IOException {
> + log.trace("enter GetMethod.readResponseBody(HttpState,
> HttpConnection)");
> +
> OutputStream out = null;
> if (useDisk) {
> if (fileData == null) {
>
>
>
> 1.9 +11 -9 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMe
th
> od.java
>
> Index: HeadMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMe
th
> od.java,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- HeadMethod.java 21 Jul 2002 04:12:46 -0000 1.8
> +++ HeadMethod.java 28 Jul 2002 18:08:59 -0000 1.9
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -66,6 +66,7 @@
> import org.apache.commons.httpclient.HttpException;
> import org.apache.commons.httpclient.HttpMethodBase;
> import org.apache.commons.httpclient.HttpState;
> +
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
>
> @@ -128,14 +129,15 @@
> * presence of a <tt>Content-Length</tt> or
> * <tt>Transfer-Encoding</tt> header.
> */
> - protected void readResponseBody(HttpState state, HttpConnection
> conn) throws IOException, HttpException {
> -
> log.debug("HeadMethod.readResponseBody(HttpState,HttpConnection)");
> + protected void readResponseBody(HttpState state, HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter HeadMethod.readResponseBody(HttpState,
> HttpConnection)");
> return; // despite the possible presence of a
content-length
> header, HEAD returns no response body
> }
>
>
> - //
--------------------------------------------------------------
> Constants
> + //
--------------------------------------------------------------
> Class Variables
>
> - /** <tt>org.apache.commons.httpclient.methods.HeadMethod</tt>
log.
> */
> - private static final Log log =
> LogFactory.getLog(HeadMethod.class.getName());
> + /** Log object for this class. */
> + private static final Log log =
LogFactory.getLog(HeadMethod.class);
> }
>
>
>
> 1.7 +11 -5 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/Option
sM
> ethod.java
>
> Index: OptionsMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/Option
sM
> ethod.java,v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -u -r1.6 -r1.7
> --- OptionsMethod.java 21 Jul 2002 04:12:46 -0000 1.6
> +++ OptionsMethod.java 28 Jul 2002 18:08:59 -0000 1.7
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -67,6 +67,8 @@
> import org.apache.commons.httpclient.HttpMethodBase;
> import org.apache.commons.httpclient.HttpState;
>
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.commons.logging.Log;
> import java.util.Enumeration;
> import java.util.StringTokenizer;
> import java.util.Vector;
> @@ -81,8 +83,10 @@
> extends HttpMethodBase {
>
>
> - //
--------------------------------------------------------------
> Constants
> + // ---------------------------------------------------------
Class
> Variables
>
> + /** Log object for this class. */
> + private static final Log log =
> LogFactory.getLog(OptionsMethod.class);
>
> // -----------------------------------------------------------
> Constructors
>
> @@ -139,6 +143,8 @@
> // -----------------------------------------------------
HttpMethod
> Methods
>
> protected void processResponseHeaders(HttpState state,
> HttpConnection conn) {
> + log.trace("enter
> OptionsMethod.processResponseHeaders(HttpState, HttpConnection)");
> +
> Header allowHeader = getResponseHeader("allow");
> if (allowHeader != null) {
> String allowHeaderValue = allowHeader.getValue();
>
>
>
> 1.15 +46 -9 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMe
th
> od.java
>
> Index: PostMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMe
th
> od.java,v
> retrieving revision 1.14
> retrieving revision 1.15
> diff -u -r1.14 -r1.15
> --- PostMethod.java 24 Jul 2002 03:00:11 -0000 1.14
> +++ PostMethod.java 28 Jul 2002 18:08:59 -0000 1.15
> @@ -184,6 +184,7 @@
> * to clear my request body.
> */
> public void recycle() {
> + log.trace("enter PostMethod.recycle()");
> super.recycle();
> requestBody = null;
> requestContentLength = CONTENT_LENGTH_AUTO;
> @@ -199,6 +200,8 @@
> * @deprecated use #removeParameter followed by #setParameter
> */
> public void setParameter(String parameterName, String
> parameterValue) {
> + log.trace("enter PostMethod.setParameter(String, String)");
> +
> if(null != requestBody) {
> throw new IllegalStateException("Request body already
> generated.");
> }
> @@ -224,6 +227,8 @@
> *
> */
> public void setRequestContentLength(int length) {
> + log.trace("enter PostMethod.setRequestContentLength(int)");
> +
> if ((length == CONTENT_LENGTH_CHUNKED) && !isHttp11()) {
> throw new RuntimeException("Chunked transfer encoding
not
> allowed for HTTP/1.0");
> }
> @@ -239,6 +244,8 @@
> * @throws IllegalArgumentException if either argument is null
> */
> public void addParameter(String paramName, String paramValue) {
> + log.trace("enter PostMethod.addParameter(String, String)");
> +
> if(null != requestBody) {
> throw new IllegalStateException("Request body already
> generated.");
> }
> @@ -260,6 +267,8 @@
> * @since 2.0
> */
> public void addParameter(NameValuePair param) {
> + log.trace("enter PostMethod.addParameter(NameValuePair)");
> +
> if(null != requestBody) {
> throw new IllegalStateException("Request body already
> generated.");
> }
> @@ -280,6 +289,8 @@
> * @since 2.0
> */
> public void addParameters(NameValuePair[] parameters) {
> + log.trace("enter
PostMethod.addParameters(NameValuePair[])");
> +
> if(null != requestBody) {
> throw new IllegalStateException("Request body already
> generated.");
> }
> @@ -304,6 +315,8 @@
> * @since 2.0
> */
> public NameValuePair getParameter(String paramName){
> + log.trace("enter PostMethod.getParameter(String)");
> +
> if (paramName == null){
> return null;
> }
> @@ -331,6 +344,8 @@
> * @since 2.0
> */
> public NameValuePair[] getParameters(){
> + log.trace("enter PostMethod.getParameters()");
> +
> int numPairs = parameters.size();
> Object[] objectArr= parameters.toArray();
> NameValuePair[] nvPairArr = new NameValuePair[numPairs];
> @@ -351,6 +366,8 @@
> * @throws IllegalStateException if my request body has already
> been generated.
> */
> public boolean removeParameter(String paramName) {
> + log.trace("enter PostMethod.removeParameter(String)");
> +
> if(null != requestBody) {
> throw new IllegalStateException("Request body already
> generated.");
> }
> @@ -380,6 +397,8 @@
> * @throws IllegalStateException if my request body has already
> been generated.
> */
> public boolean removeParameter(String paramName, String
paramValue)
> {
> + log.trace("enter PostMethod.removeParameter(String,
String)");
> +
> if(null != requestBody) {
> throw new IllegalStateException("Request body already
> generated.");
> }
> @@ -408,6 +427,8 @@
> * encoding. Use setRequestBody(InputStream) instead.
> */
> public void setRequestBody(String body) {
> + log.trace("enter PostMethod.setRequestBody(String)");
> +
> if(!parameters.isEmpty()) {
> throw new IllegalStateException("Request parameters
have
> already been added.");
> }
> @@ -415,6 +436,8 @@
> }
>
> public void setRequestBody(InputStream body) {
> + log.trace("enter PostMethod.getRequestBody(InputStream)");
> +
> if(!parameters.isEmpty()) {
> throw new IllegalStateException("Request parameters
have
> already been added.");
> }
> @@ -429,6 +452,8 @@
> * @since 2.0
> */
> public InputStream getRequestBody() {
> + log.trace("enter PostMethod.getRequestBody()");
> +
> if (requestBody != null) {
> return requestBody;
> } else if (!parameters.isEmpty()) {
> @@ -442,6 +467,8 @@
> *@return the request body as a string
> */
> public String getRequestBodyAsString() throws IOException{
> + log.trace("enter PostMethod.getRequestBodyAsString()");
> +
> StringBuffer buffer = new StringBuffer();
> InputStream requestBody = getRequestBody();
> int data = requestBody.read();
> @@ -454,10 +481,12 @@
>
>
> /**
> - * Override method of {@link
> org.apache.commons.httpclient.HttpMethodBase} to also add <tt>Content-
> Type</tt> header
> + * Override method of {@link
> org.apache.commons.httpclient.HttpMethodBase} to
> + * also add <tt>Content-Type</tt> header
> * when appropriate.
> */
> - protected void addRequestHeaders(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> + protected void addRequestHeaders(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> super.addRequestHeaders(state,conn);
> if(!parameters.isEmpty()) { //there are some parameters, so
set
> the contentType header
> setRequestHeader(CONTENT_TYPE);
> @@ -476,8 +505,10 @@
> *
> * @return always returns true
> */
> - protected boolean writeRequestBody(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> -
> log.debug("PostMethod.writeRequestBody(HttpState,HttpConnection)");
> + protected boolean writeRequestBody(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter PostMethod.writeRequestBody(HttpState,
> HttpConnection)");
> +
> if(null == requestBody) {
> requestBody = generateRequestBody(parameters);
> }
> @@ -516,6 +547,8 @@
> @return number of bytes in the request body
> */
> protected int getRequestContentLength() {
> + log.trace("enter PostMethod.getRequestContentLength()");
> +
> if(null == requestBody) {
> requestBody = generateRequestBody(parameters);
> bufferContent();
> @@ -535,6 +568,8 @@
> * If the method was called earlier it returns immediately.
> */
> private void bufferContent() {
> + log.trace("enter PostMethod.bufferContent()");
> +
> if (buffer != null) return;
> try {
> buffer = new ByteArrayOutputStream();
> @@ -563,6 +598,8 @@
> * @return urlencoded string
> */
> static InputStream generateRequestBody(List params) {
> + log.trace("enter PostMethod.generateRequestBody(List)");
> +
> Iterator it = params.iterator();
> StringBuffer sb = new StringBuffer();
> while(it.hasNext()) {
> @@ -588,8 +625,8 @@
>
> //
--------------------------------------------------------------
> Constants
>
> - /** <tt>org.apache.commons.httpclient.methods.PostMethod</tt>
log.
> */
> - private static final Log log =
> LogFactory.getLog(PostMethod.class.getName());
> + /** Log object for this class. */
> + private static final Log log =
LogFactory.getLog(PostMethod.class);
>
> /** The Content-Type header for www-form-urlcoded. */
> static final Header CONTENT_TYPE = new Header ("Content-
> Type","application/x-www-form-urlencoded");
>
>
>
> 1.12 +21 -11 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/PutMet
ho
> d.java
>
> Index: PutMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/PutMet
ho
> d.java,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -r1.11 -r1.12
> --- PutMethod.java 23 Jul 2002 14:38:31 -0000 1.11
> +++ PutMethod.java 28 Jul 2002 18:08:59 -0000 1.12
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -85,8 +85,7 @@
> *
> * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
> */
> -public class PutMethod
> - extends HttpMethodBase {
> +public class PutMethod extends HttpMethodBase {
>
>
> // -----------------------------------------------------------
> Constructors
> @@ -179,7 +178,10 @@
> * memory. To upload large entities, it is recommended to first
> buffer the
> * data into a temporary file, and then send that file.
> */
> - public void setRequestBody(InputStream is) throws IOException {
> + public void setRequestBody(InputStream is)
> + throws IOException {
> + log.trace("enter PutMethod.setRequestBody(InputStream)");
> +
> checkNotUsed();
> byte[] buffer = new byte[4096];
> ByteArrayOutputStream os = new ByteArrayOutputStream();
> @@ -203,7 +205,10 @@
> * not already been set, in addition to the "standard"
> * set of headers.
> */
> - protected void addRequestHeaders(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> + protected void addRequestHeaders(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter PutMethod.addRequestHeaders(HttpState,
> HttpConnection)");
> +
> super.addRequestHeaders(state,conn);
> // Send expectation header
> if(isHttp11() && null == getRequestHeader("expect")) {
> @@ -217,7 +222,10 @@
> * the <tt>100 Continue</tt> status has not be
> * read.
> */
> - protected boolean writeRequestBody(HttpState state,
HttpConnection
> conn) throws IOException, HttpException {
> + protected boolean writeRequestBody(HttpState state,
HttpConnection
> conn)
> + throws IOException, HttpException {
> + log.trace("enter PutMethod.writeRequestBody(HttpState,
> HttpConnection)");
> +
> if(null != getRequestHeader("expect") && getStatusCode() !=
> HttpStatus.SC_CONTINUE) {
> return false;
> }
> @@ -253,6 +261,8 @@
> * to return the appropriate content length.
> */
> protected int getRequestContentLength() {
> + log.trace("enter PutMethod.getRequestContentLength()");
> +
> if(null != data) {
> return data.length;
> } else if(null != file && file.exists()) {
> @@ -273,6 +283,6 @@
> file = null;
> }
>
> - /** <tt>org.apache.commons.httpclient.methods.PutMethod</tt>
log.
> */
> - private static final Log log =
> LogFactory.getLog(PutMethod.class.getName());
> + /** Log object for this class. */
> + private static final Log log =
LogFactory.getLog(PutMethod.class);
> }
>
>
>
> 1.6 +8 -9 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDel
et
> eMethod.java
>
> Index: UrlDeleteMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDel
et
> eMethod.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- UrlDeleteMethod.java 21 Jul 2002 04:12:46 -0000 1.5
> +++ UrlDeleteMethod.java 28 Jul 2002 18:08:59 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
> @@ -74,6 +74,7 @@
> */
> public class UrlDeleteMethod extends DeleteMethod implements
> HttpUrlMethod
> {
> +
> // -----------------------------------------------------
Instance
> Variables
> private String url;
>
> @@ -101,8 +102,7 @@
> *
> * @param url - the URL for this request.
> */
> - public void setUrl(String url) throws MalformedURLException
> - {
> + public void setUrl(String url) throws MalformedURLException {
> setPath(URIUtil.getPath(url));
> this.url = url;
> String query = URIUtil.getQueryString(url);
> @@ -112,10 +112,9 @@
> }
>
> /**
> - *
> + * Gets the Url.
> */
> - public String getUrl()
> - {
> + public String getUrl() {
> return url;
> }
>
>
>
>
> 1.6 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGet
Me
> thod.java
>
> Index: UrlGetMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGet
Me
> thod.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- UrlGetMethod.java 21 Jul 2002 04:12:46 -0000 1.5
> +++ UrlGetMethod.java 28 Jul 2002 18:08:59 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.6 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHea
dM
> ethod.java
>
> Index: UrlHeadMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHea
dM
> ethod.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- UrlHeadMethod.java 21 Jul 2002 04:12:46 -0000 1.5
> +++ UrlHeadMethod.java 28 Jul 2002 18:08:59 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.6 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOpt
io
> nsMethod.java
>
> Index: UrlOptionsMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOpt
io
> nsMethod.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- UrlOptionsMethod.java 21 Jul 2002 04:12:46 -0000 1.5
> +++ UrlOptionsMethod.java 28 Jul 2002 18:08:59 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.6 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPos
tM
> ethod.java
>
> Index: UrlPostMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPos
tM
> ethod.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- UrlPostMethod.java 21 Jul 2002 04:12:46 -0000 1.5
> +++ UrlPostMethod.java 28 Jul 2002 18:08:59 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
> 1.6 +4 -4 jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPut
Me
> thod.java
>
> Index: UrlPutMethod.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
>
commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPut
Me
> thod.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- UrlPutMethod.java 21 Jul 2002 04:12:46 -0000 1.5
> +++ UrlPutMethod.java 28 Jul 2002 18:08:59 -0000 1.6
> @@ -6,7 +6,7 @@
> *
> * The Apache Software License, Version 1.1
> *
> - * Copyright (c) 1999 The Apache Software Foundation. All rights
> + * Copyright (c) 1999-2002 The Apache Software Foundation. All
rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or
without
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:commons-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-
> help@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>