olegk 2003/07/05 15:31:21
Modified: httpclient/src/java/org/apache/commons/httpclient
Cookie.java HttpClient.java HttpConnection.java
HttpState.java
MultiThreadedHttpConnectionManager.java URI.java
httpclient/src/java/org/apache/commons/httpclient/util
URIUtil.java
httpclient/src/test/org/apache/commons/httpclient
TestAuthenticator.java TestHttpState.java
TestHttps.java TestMethodsExternalHost.java
TestWebappBasicAuth.java
Removed: httpclient/src/java/org/apache/commons/httpclient
Authenticator.java HttpUrlMethod.java
RequestOutputStream.java ResponseInputStream.java
Log:
Deprecated methods in Cookie, HttpClient, HttpConnection, HttpState, URI, URIUtil
classes removed. Deprecated classes Authenticator, HttpUrlMethod, RequestOutputStream,
ResponseInputStream removed.
Revision Changes Path
1.39 +4 -293
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.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- Cookie.java 4 Feb 2003 21:22:07 -0000 1.38
+++ Cookie.java 5 Jul 2003 22:31:20 -0000 1.39
@@ -473,172 +473,6 @@
}
/**
- * Return <tt>true</tt> if I should be submitted with a request with given
- * attributes, <tt>false</tt> otherwise.
- * @param domain the host to which the request is being submitted
- * @param port the port to which the request is being submitted (currently
- * ignored)
- * @param path the path to which the request is being submitted
- * @param secure <tt>true</tt> if the request is using the HTTPS protocol
- * @param date the time at which the request is submitted
- * @return true if the cookie matches
- *
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- public boolean matches(
- String domain, int port, String path, boolean secure, Date date) {
-
- LOG.trace("enter Cookie.matches(Strinng, int, String, boolean, Date");
- CookieSpec matcher = CookiePolicy.getDefaultSpec();
- return matcher.match(domain, port, path, secure, this);
- }
-
- /**
- * Return <tt>true</tt> if I should be submitted with a request with given
- * attributes, <tt>false</tt> otherwise.
- * @param domain the host to which the request is being submitted
- * @param port the port to which the request is being submitted (currently
- * ignored)
- * @param path the path to which the request is being submitted
- * @param secure True if this cookie has the secure flag set
- * @return true if I should be submitted as above.
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- public boolean matches(
- String domain, int port, String path, boolean secure) {
- LOG.trace("enter Cookie.matches(String, int, String, boolean");
- return matches(domain, port, path, secure, new Date());
- }
-
- /**
- * Create a <tt>Cookie</tt> header containing
- * all non-expired cookies in <i>cookies</i>,
- * associated with the given <i>domain</i> and
- * <i>path</i>, assuming the connection is not
- * secure.
- * <p>
- * If no cookies match, returns null.
- *
- * @param domain The domain
- * @param path The path
- * @param cookies The cookies to use
- * @return The new header.
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- 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);
- }
-
- /**
- * Create a <tt>Cookie</tt> header containing
- * all non-expired cookies in <i>cookies</i>,
- * associated with the given <i>domain</i>, <i>path</i> and
- * <i>https</i> setting.
- * <p>
- * If no cookies match, returns null.
- *
- * @param domain The domain
- * @param path The path
- * @param secure True if this cookie has the secure flag set
- * @param cookies The cookies to use.
- * @return The new header
- * @exception IllegalArgumentException if domain or path is null
- *
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- 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.");
- }
- // parse port from domain, if any
- int port = secure ? 443 : 80;
- int ndx = domain.indexOf(":");
- if (ndx != -1) {
- try {
- port = Integer.parseInt(domain.substring(ndx + 1,
- domain.length()));
- } catch (NumberFormatException e) {
- // ignore?, but at least LOG
- LOG.warn("Cookie.createCookieHeader(): "
- + "Invalid port number in domain " + domain);
- }
- }
- return Cookie.createCookieHeader(domain, port, path, secure, cookies);
- }
-
- /**
- * Create a <tt>Cookie</tt> header containing
- * all non-expired cookies in <i>cookies</i>,
- * associated with the given <i>domain</i>, <i>port</i>,
- * <i>path</i> and <i>https</i> setting.
- * <p>
- * If no cookies match, returns null.
- *
- * @param domain The domain
- * @param port The port
- * @param path The path
- * @param secure True if this cookie has the secure flag set
- * @param cookies The cookies to use.
- * @return The new header
- * @throws IllegalArgumentException if domain or path is null
- *
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- public static Header createCookieHeader(String domain, int port,
- String path, boolean secure, Cookie[] cookies)
- throws IllegalArgumentException {
- LOG.trace("enter Cookie.createCookieHeader(String, int, String, boolean,
Cookie[])");
- return Cookie.createCookieHeader(domain, port, path, secure, new Date(),
cookies);
- }
-
- /**
- * Create a <tt>Cookie</tt> header containing all cookies in <i>cookies</i>,
- * associated with the given <i>domain</i>, <i>port</i>, <i>path</i> and
- * <i>https</i> setting, and which are not expired according to the given
- * <i>date</i>.
- * <p>
- * If no cookies match, returns null.
- *
- * @param domain The domain
- * @param port The port
- * @param path The path
- * @param secure True if this cookie has the secure flag set
- * @param now The date to check for expiry
- * @param cookies The cookies to use.
- * @return The new header
- * @throws IllegalArgumentException if domain or path is null
- *
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
-
- 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, boolean,
Date, Cookie[])");
- CookieSpec matcher = CookiePolicy.getDefaultSpec();
- cookies = matcher.match(domain, port, path, secure, cookies);
- if ((cookies != null) && (cookies.length > 0)) {
- return matcher.formatCookieHeader(cookies);
- } else {
- return null;
- }
- }
-
- /**
* <p>Compares two cookies to determine order for cookie header.</p>
* <p>Most specific should be first. </p>
* <p>This method is implemented so a cookie can be used as a comparator for
@@ -688,129 +522,6 @@
*/
public String toString() {
return toExternalForm();
- }
-
- /**
- * Parses the Set-Cookie [EMAIL PROTECTED] Header} into an array of
- * <tt>Cookie</tt>s, assuming that the cookies were recieved
- * on an insecure channel.
- *
- * @param domain the domain from which the [EMAIL PROTECTED] Header} was
received
- * @param port the port from which the [EMAIL PROTECTED] Header} was received
- * (currently ignored)
- * @param path the path from which the [EMAIL PROTECTED] Header} was received
- * @param setCookie the <tt>Set-Cookie</tt> [EMAIL PROTECTED] Header} received
from the
- * server
- * @return an array of <tt>Cookie</tt>s parsed from the Set-Cookie [EMAIL
PROTECTED]
- * Header}
- * @throws HttpException if an exception occurs during parsing
- * @throws IllegalArgumentException if domain or path are null
- */
- 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);
- }
-
- /**
- * Parses the Set-Cookie [EMAIL PROTECTED] Header} into an array of
- * <tt>Cookie</tt>s, assuming that the cookies were recieved
- * on an insecure channel.
- *
- * @param domain the domain from which the [EMAIL PROTECTED] Header} was
received
- * @param path the path from which the [EMAIL PROTECTED] Header} was received
- * @param setCookie the <tt>Set-Cookie</tt> [EMAIL PROTECTED] Header} received
from the
- * server
- * @return an array of <tt>Cookie</tt>s parsed from the Set-Cookie [EMAIL
PROTECTED]
- * Header}
- * @throws HttpException if an exception occurs during parsing
- * @throws IllegalArgumentException if domain or path are null
- *
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- 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);
- }
-
- /**
- * Parses the Set-Cookie [EMAIL PROTECTED] Header} into an array of
- * <tt>Cookie</tt>s.
- *
- * @param domain the domain from which the [EMAIL PROTECTED] Header} was
received
- * @param path the path from which the [EMAIL PROTECTED] Header} was received
- * @param secure <tt>true</tt> when the header was recieved over a secure
- * channel
- * @param setCookie the <tt>Set-Cookie</tt> [EMAIL PROTECTED] Header} received
from the
- * server
- * @return an array of <tt>Cookie</tt>s parsed from the Set-Cookie [EMAIL
PROTECTED]
- * Header}
- * @throws HttpException if an exception occurs during parsing
- * @throws IllegalArgumentException if domain or path are null
- *
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- public static Cookie[] parse(String domain, String path,
- boolean secure, Header setCookie)
- throws HttpException, IllegalArgumentException {
-
- LOG.trace ("enter Cookie.parse(String, String, boolean, Header)");
- return Cookie.parse (
- domain, (secure ? 443 : 80), path, secure, setCookie);
- }
-
- /**
- * Parses the Set-Cookie [EMAIL PROTECTED] Header} into an array of
- * <tt>Cookie</tt>s.
- *
- * <P>The syntax for the Set-Cookie response header is:
- *
- * <PRE>
- * set-cookie = "Set-Cookie:" cookies
- * cookies = 1#cookie
- * cookie = NAME "=" VALUE * (";" cookie-av)
- * NAME = attr
- * VALUE = value
- * cookie-av = "Comment" "=" value
- * | "Domain" "=" value
- * | "Max-Age" "=" value
- * | "Path" "=" value
- * | "Secure"
- * | "Version" "=" 1*DIGIT
- * </PRE>
- *
- * @param domain the domain from which the [EMAIL PROTECTED] Header} was
received
- * @param port The port from which the [EMAIL PROTECTED] Header} was received.
- * @param path the path from which the [EMAIL PROTECTED] Header} was received
- * @param secure <tt>true</tt> when the [EMAIL PROTECTED] Header} was received
over
- * HTTPS
- * @param setCookie the <tt>Set-Cookie</tt> [EMAIL PROTECTED] Header} received
from
- * the server
- * @return an array of <tt>Cookie</tt>s parsed from the Set-Cookie [EMAIL
PROTECTED]
- * Header}
- * @throws HttpException if an exception occurs during parsing
- *
- * @deprecated use [EMAIL PROTECTED] CookieSpec} interface
- */
- public static Cookie[] parse(String domain, int port, String path,
- boolean secure, Header setCookie)
- throws HttpException {
-
- LOG.trace("enter Cookie.parse(String, int, String, boolean, Header)");
-
- CookieSpec parser = CookiePolicy.getDefaultSpec();
- Cookie[] cookies = parser.parse(domain, port, path, secure, setCookie);
-
- for (int i = 0; i < cookies.length; i++) {
- final Cookie cookie = cookies[i];
- final CookieSpec validator
- = CookiePolicy.getSpecByVersion(cookie.getVersion());
- validator.validate(domain, port, path, secure, cookie);
- }
- return cookies;
}
// ----------------------------------------------------- Instance Variables
1.78 +4 -246
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.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- HttpClient.java 5 Jul 2003 18:51:24 -0000 1.77
+++ HttpClient.java 5 Jul 2003 22:31:20 -0000 1.78
@@ -64,11 +64,9 @@
package org.apache.commons.httpclient;
import java.io.IOException;
-import java.net.URL;
import java.security.Security;
import java.security.Provider;
-import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -253,237 +251,6 @@
// --------------------------------------------------------- Public Methods
/**
- * @deprecated use hostConfiguration
- *
- * Sets the host, port and protocol(http) to be used when executing a
- * method.
- *
- * @param host the host to connect to
- * @param port the port to connect to
- *
- * @see #getHostConfiguration()
- */
- public void startSession(String host, int port) {
- LOG.trace("enter HttpClient.startSession(String, int)");
- startSession(host, port, false);
- }
-
- /**
- * @deprecated use hostConfiguration
- *
- * Sets the host, port and protocol to be used when executing a method.
- *
- * @param host the host to connect to
- * @param port the port to connect to
- * @param https when <code>true</code>, create an HTTPS session
- *
- * @see #getHostConfiguration()
- */
- 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);
- }
-
- this.hostConfiguration.setHost(host, port, https ? "https" : "http");
- }
-
- /**
- * @deprecated use hostConfiguration and httpState
- *
- * Sets the host, port, protocol(http) and credentials to be used when
- * executing a method.
- *
- * @param host the host to connect to
- * @param port the port to connect to
- * @param creds the default credentials to use
- *
- * @see #getHostConfiguration()
- * @see #getState()
- * @see #startSession(String, int, Credentials, boolean)
- */
- public void startSession(String host, int port, Credentials creds) {
- LOG.trace("enter HttpClient.startSession(String, int, Credentials)");
- startSession(host, port, creds, false);
- }
-
- /**
- * @deprecated use hostConfiguration and httpState
- *
- * Sets the host, port, protocol and credentials to be used when executing a
- * method.
- *
- * @param host the host to connect to
- * @param port the port to connect to
- * @param creds the default credentials to use
- * @param https when <code>true</code>, create an HTTPS session
- *
- * @see #getHostConfiguration()
- * @see #getState()
- */
- 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(
- "Starting HttpClient session"
- + " Host:" + host
- + " Port:" + port + " Credentials:" + creds
- + " HTTPS:" + https);
- }
- getState().setCredentials(null, creds);
- this.hostConfiguration.setHost(
- host,
- port,
- https ? "https" : "http"
- );
- }
-
- /**
- * @deprecated use hostConfiguration and httpState
- *
- * Sets the host, port, protocol and credentials to be used when executing a
- * method using the server specified by the scheme, userinfo, host and port
- * of the given <i>uri</i>.
- * <p>
- * Note that the path component is not utilized.
- * <p>
- * @param uri an <code>HttpURL</code> or <code>HttpsURL</code> instance; the
- * [EMAIL PROTECTED] URI URI} from which the scheme, userinfo, host and port of
the
- * session are determined
- *
- * @throws IllegalStateException not enough information to process
- * @throws URIException If the URI is bad.
- *
- * @see #getHostConfiguration()
- * @see #getState()
- */
- public void startSession(URI uri)
- throws URIException, IllegalStateException {
-
- LOG.trace("enter HttpClient.startSession(URI)");
-
- String scheme = uri.getScheme();
- if (scheme == null) { // it may a URI instance or abs_path
- LOG.error("no scheme to start a session");
- throw new IllegalStateException("no scheme to start a session");
- }
-
- Protocol protocol = Protocol.getProtocol(scheme);
-
- String userinfo = uri.getUserinfo();
- if (userinfo != null) {
- getState().setCredentials(null,
- new UsernamePasswordCredentials(userinfo));
- }
- String host = uri.getHost();
- if (host == null || host.length() == 0) {
- LOG.error("no host to start a session");
- throw new IllegalStateException("no host to start a session");
- }
- int port = uri.getPort();
- if (port == -1) { // neither HttpURL or HttpsURL instance
- LOG.error("HttpURL or HttpsURL instance required");
- throw new IllegalStateException
- ("HttpURL or HttpsURL instance required");
- }
- this.hostConfiguration.setHost(host, null, port, protocol);
- }
-
- /**
- * @deprecated use hostConfiguration
- *
- * Sets the host, port and protocol to be used when executing a method.
- * <p>
- * Note that everything but the protocol, host and port of the
- * given <i>url</i> is ignored.
- * </p>
- * @param url the [EMAIL PROTECTED] URL URL} from which the protocol, host, and
port of
- * the session are determined
- *
- * @exception IllegalArgumentException if the protocol is not http or https
- *
- * @see #getHostConfiguration()
- */
- public void startSession(URL url) throws IllegalArgumentException {
- LOG.trace("enter HttpClient.startSession(String, int, Credentials,
boolean)");
-
- int port = url.getPort();
- Protocol protocol = Protocol.getProtocol(url.getProtocol());
-
- hostConfiguration.setHost(url.getHost(), null, port, protocol);
- }
-
- /**
- * @deprecated use hostConfiguration and httpState
- *
- * Sets the host, port, protocol and credentials to be used when executing a
- * method.
- * <p>
- * Note that everything but the protocol, host and port of the
- * given <i>url</i> is ignored.
- * </p>
- * @param url the [EMAIL PROTECTED] URL URL} from which the protocol, host, and
port of
- * the session are determined
- * @param creds the default credentials to use
- *
- * @exception IllegalArgumentException if the protocol is not http or https
- *
- * @see #getHostConfiguration()
- * @see #getState()
- */
- public void startSession(URL url, Credentials creds)
- throws IllegalArgumentException {
-
- LOG.trace("enter HttpClient.startSession(URL, Credentials)");
- getState().setCredentials(null, creds);
- startSession(url);
- }
-
- /**
- * @deprecated use hostConfiguration
- *
- * Sets the host, port, protocol(http) and proxy to be used when executing a
- * method.
- *
- * @param host the host to connect to
- * @param port the port to connect to
- * @param proxyhost the proxy host to connect via
- * @param proxyport the proxy port to connect via
- *
- * @see #getHostConfiguration()
- */
- 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);
- }
-
- /**
- * @deprecated use hostConfiguration
- *
- * Sets the host, port, protocol and proxy to be used when executing a
- * method.
- *
- * @param host the host to connect to
- * @param port the port to connect to
- * @param proxyhost the proxy host to connect via
- * @param proxyport the proxy port to connect via
- * @param secure whether or not to connect using HTTPS
- *
- * @see #getHostConfiguration()
- */
- public void startSession(String host, int port,
- String proxyhost, int proxyport, boolean secure) {
-
- LOG.trace("enter HttpClient.startSession("
- + "String, int, String, int, boolean)");
- this.hostConfiguration.setHost (host, port, secure ? "https" : "http");
- this.hostConfiguration.setProxy(proxyhost, proxyport);
- }
-
- /**
* Executes the given method.
*
* @param method the [EMAIL PROTECTED] HttpMethod} to execute.
@@ -633,15 +400,6 @@
}
return method.execute(state, connection);
- }
-
- /**
- * @deprecated this method has no effect. HttpMethod.releaseConnection()
- * should be used to release resources after a HttpMethod has been executed.
- *
- * @see HttpMethod#releaseConnection()
- */
- public void endSession() throws IOException {
}
/**
1.68 +6 -106
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.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- HttpConnection.java 26 May 2003 22:07:21 -0000 1.67
+++ HttpConnection.java 5 Jul 2003 22:31:20 -0000 1.68
@@ -125,23 +125,7 @@
* @param port the port I should connect to
*/
public HttpConnection(String host, int port) {
- this(null, -1, host, port, false);
- }
-
- /**
- * Constructor.
- *
- * @param host the host I should connect to
- * @param port the port I should connect to
- * @param secure when <tt>true</tt>, connect via HTTPS (SSL)
- *
- * @deprecated use HttpConnection(String, int, Protocol)
- *
- * @see #HttpConnection(String,int,Protocol)
- *
- */
- public HttpConnection(String host, int port, boolean secure) {
- this(null, -1, host, port, secure);
+ this(null, -1, host, null, port, Protocol.getProtocol("http"));
}
/**
@@ -180,31 +164,7 @@
int proxyPort,
String host,
int port) {
- this(proxyHost, proxyPort, host, port, false);
- }
-
- /**
- * Fully-specified constructor.
- *
- * @param proxyHost the host I should proxy via
- * @param proxyPort the port I should proxy via
- * @param host the host I should connect to. Parameter value must be non-null.
- * @param port the port I should connect to
- * @param secure when <tt>true</tt>, connect via HTTPS (SSL)
- *
- * @deprecated use HttpConnection(String, int, String, int, Protocol)
- *
- * @see #HttpConnection(String, int, String, String, int, Protocol)
- *
- */
- public HttpConnection(
- String proxyHost,
- int proxyPort,
- String host,
- int port,
- boolean secure) {
- this(proxyHost, proxyPort, host, null, port,
- Protocol.getProtocol(secure ? "https" : "http"));
+ this(proxyHost, proxyPort, host, null, port, Protocol.getProtocol("http"));
}
/**
@@ -416,23 +376,6 @@
}
/**
- * Set whether or not I should connect over HTTPS (SSL).
- *
- * @param secure whether or not I should connect over HTTPS (SSL).
- * @throws IllegalStateException if I am already connected
- *
- * @deprecated use setProtocol(Protocol)
- *
- * @see #setProtocol(Protocol)
- */
- public void setSecure(boolean secure) throws IllegalStateException {
- assertNotOpen();
- protocolInUse = secure
- ? Protocol.getProtocol("https")
- : Protocol.getProtocol("http");
- }
-
- /**
* Sets the protocol used by this connection.
*
* @param protocol The new protocol.
@@ -799,49 +742,6 @@
out = new WireLogOutputStream(out);
}
return out;
- }
-
- /**
- * Return a [EMAIL PROTECTED] OutputStream} suitable for writing (possibly
- * chunked) bytes to my [EMAIL PROTECTED] OutputStream}.
- *
- * @param useChunking when <tt>true</tt> the chunked transfer-encoding will
- * be used
- * @throws IllegalStateException if I am not connected
- * @throws IOException if an I/O problem occurs
- * @return a stream to write the request to
- * @deprecated Use new
ChunkedOutputStream(httpConnecion.getRequestOutputStream());
- */
- public OutputStream getRequestOutputStream(boolean useChunking)
- throws IOException, IllegalStateException {
- LOG.trace("enter HttpConnection.getRequestOutputStream(boolean)");
-
- OutputStream out = getRequestOutputStream();
- if (useChunking) {
- out = new ChunkedOutputStream(out);
- }
- return out;
- }
-
- /**
- * Return a [EMAIL PROTECTED] InputStream} suitable for reading (possibly
- * chunked) bytes from my [EMAIL PROTECTED] InputStream}.
- * <p>
- * If the given [EMAIL PROTECTED] HttpMethod} contains
- * a <tt>Transfer-Encoding: chunked</tt> header,
- * the returned stream will be configured
- * to read chunked bytes.
- *
- * @param method This argument is ignored.
- * @throws IllegalStateException if I am not connected
- * @throws IOException if an I/O problem occurs
- * @return a stream to read the response from
- * @deprecated Use getResponseInputStream() instead.
- */
- public InputStream getResponseInputStream(HttpMethod method)
- throws IOException, IllegalStateException {
- LOG.trace("enter HttpConnection.getResponseInputStream(HttpMethod)");
- return getResponseInputStream();
}
/**
1.24 +4 -134
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.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- HttpState.java 5 Jul 2003 18:51:24 -0000 1.23
+++ HttpState.java 5 Jul 2003 22:31:20 -0000 1.24
@@ -249,33 +249,6 @@
* @param port the request port
* @param path the request path
* @param secure <code>true</code> when using HTTPS
- * @param now the [EMAIL PROTECTED] Date} by which expiration is determined
- * @return an array of my [EMAIL PROTECTED] Cookie}s.
- *
- * @see Cookie#matches
- * @see #getCookies()
- *
- * @deprecated use HttpState.getCookies(String, int, String, boolean)
- */
- public synchronized Cookie[] getCookies(
- String domain,
- int port,
- String path,
- boolean secure,
- Date now
- ) {
- return getCookies(domain, port, path, secure);
- }
-
-
- /**
- * Obtain an array of my [EMAIL PROTECTED] Cookie}s that
- * match the given request parameters.
- *
- * @param domain the request domain
- * @param port the request port
- * @param path the request path
- * @param secure <code>true</code> when using HTTPS
* @return an array of my [EMAIL PROTECTED] Cookie}s.
*
* @see Cookie#matches
@@ -382,34 +355,6 @@
this.cookiePolicy = policy;
}
- /**
- * Set the Credentials for the given authentication realm.
- *
- * When <i>realm</i> is <code>null</code>, I'll use the given
- * <i>credentials</i> when no other [EMAIL PROTECTED] Credentials} have
- * been supplied for the given challenging realm.
- * (I.e., use a <code>null</code> realm to set the "default"
- * credentials.)
- * <p>
- * Any previous credentials for this realm will be overwritten.
- *
- * @deprecated This method does not distinguish between realms with the
- * same name on different hosts. Use
- * [EMAIL PROTECTED] HttpState#setCredentials(String, Credentials)} instead.
- *
- * @param realm the authentication realm
- * @param credentials the authentication credentials for the given realm
- *
- * @see #getCredentials(String, String)
- * @see #setProxyCredentials(String, String, Credentials)
- *
- */
-
- public synchronized void setCredentials(String realm, Credentials credentials) {
- LOG.trace("enter HttpState.setCredentials(String, Credentials)");
- setCredentials(realm, null, credentials);
- }
-
/** Sets the credentials for <tt>realm</tt> on <tt>host</tt>.
* with no host.
*
@@ -495,61 +440,6 @@
}
/**
- * Get the Credentials for the given authentication realm.
- *
- * If the <i>realm</i> exists on <i>host</i>, return the coresponding
credentials.
- * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
- * corresponding credentials. If the <i>realm</i> does not exist, return
- * the default Credentials. If there is no default credentials, return
- * <code>null</code>.
- *
- * @deprecated This method does not distinguish between realms on different
- * servers with the same name. Use [EMAIL PROTECTED] #getCredentials(String,
String)}
- * instead.
- *
- * @param realm the authentication realm
- * @return the credentials
- *
- * @see #setCredentials(String, String, Credentials)
- *
- */
-
- public synchronized Credentials getCredentials(String realm) {
- LOG.trace("enter HttpState.getCredentials(String)");
-
- return getCredentials(realm, null);
- }
-
- /**
- * Set the for the proxy with the given authentication realm.
- *
- * When <i>realm</i> is <code>null</code>, I'll use the given
- * <i>credentials</i> when no other [EMAIL PROTECTED] Credentials} have
- * been supplied for the given challenging realm.
- * (I.e., use a <code>null</code> realm to set the "default"
- * credentials.) Realms rarely make much sense with proxies, so
- * <code>null</code> is normally a good choice here.
- * <p>
- * Any previous credentials for this realm will be overwritten.
- *
- * @deprecated This method does not differentiate between realms with
- * the same name on different servers. Use
- * [EMAIL PROTECTED] #setProxyCredentials(String, String, Credentials)} instead.
- *
- * @param realm the authentication realm
- * @param credentials the authentication credentials for the given realm
- *
- * @see #getProxyCredentials(String)
- * @see #setCredentials(String, Credentials)
- *
- */
-
- public synchronized void setProxyCredentials(String realm, Credentials
credentials) {
- LOG.trace("enter HttpState.setProxyCredentials(String, credentials)");
- setProxyCredentials(realm, null, credentials);
- }
-
- /**
* Set the credentials for the proxy with the given authentication realm.
*
* When <i>realm</i> and <i>proxyHost</i> are <code>null</code>, I'll use the
given
@@ -578,26 +468,6 @@
proxyCred.put(new HttpAuthRealm(proxyHost, realm), credentials);
}
- /**
- * Get the Credentials for the proxy with the given authentication realm.
- *
- * If the <i>realm</i> exists, return the coresponding credentials. If the
- * <i>realm</i> does not exist, return the default Credentials. If there is
- * no default credentials, return <code>null</code>.
- *
- * @deprecated This method does not distinguish between realms on different
hosts.
- * Use [EMAIL PROTECTED] #getProxyCredentials(String, String)} instead.
- *
- * @param realm the authentication realm
- * @return the credentials
- * @see #setProxyCredentials(String, String, Credentials)
- */
-
- public synchronized Credentials getProxyCredentials(String realm) {
- LOG.trace("enter HttpState.getProxyCredentials(String)");
- return getProxyCredentials(realm, null);
- }
-
/**
* Get the Credentials for the proxy with the given authentication realm on the
given
* <i>host</i>.
1.18 +3 -29
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
Index: MultiThreadedHttpConnectionManager.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- MultiThreadedHttpConnectionManager.java 27 Jun 2003 03:20:32 -0000 1.17
+++ MultiThreadedHttpConnectionManager.java 5 Jul 2003 22:31:20 -0000 1.18
@@ -785,15 +785,6 @@
}
}
- public OutputStream getRequestOutputStream(boolean useChunking)
- throws IOException, IllegalStateException {
- if (hasConnection()) {
- return wrappedConnection.getRequestOutputStream(useChunking);
- } else {
- return null;
- }
- }
-
public InputStream getResponseInputStream()
throws IOException, IllegalStateException {
if (hasConnection()) {
@@ -803,15 +794,6 @@
}
}
- public InputStream getResponseInputStream(HttpMethod method)
- throws IOException, IllegalStateException {
- if (hasConnection()) {
- return wrappedConnection.getResponseInputStream(method);
- } else {
- return null;
- }
- }
-
public boolean isOpen() {
if (hasConnection()) {
return wrappedConnection.isOpen();
@@ -972,14 +954,6 @@
public void setProxyPort(int port) throws IllegalStateException {
if (hasConnection()) {
wrappedConnection.setProxyPort(port);
- } else {
- // do nothing
- }
- }
-
- public void setSecure(boolean secure) throws IllegalStateException {
- if (hasConnection()) {
- wrappedConnection.setSecure(secure);
} else {
// do nothing
}
1.37 +4 -18
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java
Index: URI.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- URI.java 1 Jul 2003 01:12:29 -0000 1.36
+++ URI.java 5 Jul 2003 22:31:20 -0000 1.37
@@ -71,7 +71,6 @@
import java.util.Locale;
import java.util.BitSet;
import java.util.Hashtable;
-import java.net.URL;
import java.security.AccessController;
import sun.security.action.GetPropertyAction;
@@ -221,19 +220,6 @@
*/
public URI(String original) throws URIException {
parseUriReference(original, false);
- }
-
-
- /**
- * Construct a URI from a URL.
- *
- * @param url a valid URL.
- * @throws URIException If the URI cannot be created.
- * @since 2.0
- * @deprecated currently somewhat wrong and diffrent with java.net.URL usage
- */
- public URI(URL url) throws URIException {
- this(url.toString());
}
1.22 +4 -115
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/util/URIUtil.java
Index: URIUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/util/URIUtil.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- URIUtil.java 29 Jun 2003 21:34:06 -0000 1.21
+++ URIUtil.java 5 Jul 2003 22:31:21 -0000 1.22
@@ -63,7 +63,6 @@
package org.apache.commons.httpclient.util;
-import java.io.UnsupportedEncodingException;
import java.util.BitSet;
import org.apache.commons.httpclient.URI;
import org.apache.commons.httpclient.URIException;
@@ -573,116 +572,6 @@
throws URIException {
return Coder.decode(escaped.toCharArray(), charset);
- }
-
- // --------------------------------- transforming a string between charsets
-
- /**
- * Convert a target string to the specified character encoded string with
- * the default protocol charset.
- *
- * @param target a target string
- * @return the protocol character encoded string
- *
- * @throws URIException if the default protocol charset is not supported
- *
- * @see URI#getDefaultProtocolCharset
- *
- * @deprecated Do not use. To be removed
- */
- public static String toProtocolCharset(String target) throws URIException {
- return toUsingCharset(
- target,
- URI.getDefaultDocumentCharset(),
- URI.getDefaultProtocolCharset());
- }
-
-
- /**
- * Convert a target string to the specified character encoded string with
- * a given protocol charset.
- *
- * @param target a target string
- * @param charset the transformed protocol charset
- * @return the protocol character encoded string
- *
- * @throws URIException if the charset is not supported
- *
- * @deprecated Do not use. To be removed
- */
- public static String toProtocolCharset(String target, String charset)
- throws URIException {
-
- return toUsingCharset(target, URI.getDefaultDocumentCharset(), charset);
- }
-
-
- /**
- * Convert a target string to the specified character encoded string with
- * the default document charset.
- *
- * @param target a target string
- * @return the document character encoded string
- *
- * @throws URIException if the default protocol charset is not supported
- *
- * @see URI#getDefaultDocumentCharset
- *
- * @deprecated Do not use. To be removed
- */
- public static String toDocumentCharset(String target) throws URIException {
- return toUsingCharset(target, URI.getDefaultProtocolCharset(),
- URI.getDefaultDocumentCharset());
- }
-
-
- /**
- * Convert a target string to the specified character encoded string with
- * a given document charset.
- *
- * @param target a target string
- * @param charset the transformed document charset
- * @return the document character encoded string
- *
- * @throws URIException if the charset is not supported
- *
- * @deprecated Do not use. To be removed
- */
- public static String toDocumentCharset(String target, String charset)
- throws URIException {
-
- return toUsingCharset(target, URI.getDefaultProtocolCharset(), charset);
- }
-
-
- /**
- * Convert a target string from the <code>fromCharset</code> charset to
- * the <code>toCharset</code> charset.
- * <p>
- * What if the document charset is ISO-8859-1 and the protocol charset is
- * UTF-8, when it's read from the document part and is used in the protocol
- * part, the use of the method will be <code>toUsingCharset(the string,
- * "ISO-8859-1", "UTF-8")</code>.
- *
- * @param target a target string
- * @param fromCharset the previous charset
- * @param toCharset the changing charset
- * @return the document character encoded string
- *
- * @throws URIException if either of the charsets are not supported
- *
- * @deprecated Do not use. To be removed
- */
-
- public static String toUsingCharset(String target, String fromCharset,
- String toCharset) throws URIException {
-
- try {
- return new String(target.getBytes(fromCharset), toCharset);
- } catch (UnsupportedEncodingException error) {
- throw new URIException(URIException.UNSUPPORTED_ENCODING,
- error.getMessage());
- }
}
// ---------------------------------------------------------- Inner classes
1.26 +6 -6
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAuthenticator.java
Index: TestAuthenticator.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAuthenticator.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TestAuthenticator.java 22 Apr 2003 17:00:26 -0000 1.25
+++ TestAuthenticator.java 5 Jul 2003 22:31:21 -0000 1.26
@@ -641,7 +641,7 @@
public void testMultipleProxyChallengeBasic() throws Exception {
HttpState state = new HttpState();
- state.setProxyCredentials("Protected", new
UsernamePasswordCredentials("name", "pass"));
+ state.setProxyCredentials("Protected", null, new
UsernamePasswordCredentials("name", "pass"));
HttpMethod method = new SimpleHttpMethod();
SimpleHttpConnection conn = new SimpleHttpConnection();
conn.addResponse(
@@ -667,7 +667,7 @@
public void testMultipleProxyChallengeDigest() throws Exception {
HttpState state = new HttpState();
- state.setProxyCredentials("Protected", new
UsernamePasswordCredentials("name", "pass"));
+ state.setProxyCredentials("Protected", null, new
UsernamePasswordCredentials("name", "pass"));
HttpMethod method = new SimpleHttpMethod();
SimpleHttpConnection conn = new SimpleHttpConnection();
conn.addResponse(
1.4 +22 -22
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpState.java
Index: TestHttpState.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpState.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestHttpState.java 23 Jan 2003 22:48:27 -0000 1.3
+++ TestHttpState.java 5 Jul 2003 22:31:21 -0000 1.4
@@ -106,10 +106,10 @@
public void testHttpStateCredentials() {
HttpState state = new HttpState();
- state.setCredentials(realm1, creds1);
- state.setCredentials(realm2, creds2);
- assertEquals(creds1, state.getCredentials(realm1));
- assertEquals(creds2, state.getCredentials(realm2));
+ state.setCredentials(realm1, null, creds1);
+ state.setCredentials(realm2, null, creds2);
+ assertEquals(creds1, state.getCredentials(realm1, null));
+ assertEquals(creds2, state.getCredentials(realm2, null));
}
public void testToString()
@@ -123,44 +123,44 @@
state.addCookie(new Cookie("flub", "duck", "yuck"));
assertNotNull(state.toString());
- state.setCredentials(realm1, creds1);
+ state.setCredentials(realm1, null, creds1);
assertNotNull(state.toString());
- state.setProxyCredentials(realm2, creds2);
+ state.setProxyCredentials(realm2, null, creds2);
assertNotNull(state.toString());
}
public void testHttpStateNoCredentials() {
HttpState state = new HttpState();
- assertEquals(null, state.getCredentials("bogus"));
+ assertEquals(null, state.getCredentials("bogus", null));
}
public void testHttpStateDefaultCredentials() {
HttpState state = new HttpState();
- state.setCredentials(null, creds1);
- state.setCredentials(realm2, creds2);
- assertEquals(creds1, state.getCredentials("bogus"));
+ state.setCredentials(null, null, creds1);
+ state.setCredentials(realm2, null, creds2);
+ assertEquals(creds1, state.getCredentials("bogus", null));
}
public void testHttpStateProxyCredentials() {
HttpState state = new HttpState();
- state.setProxyCredentials(realm1, creds1);
- state.setProxyCredentials(realm2, creds2);
- assertEquals(creds1, state.getProxyCredentials(realm1));
- assertEquals(creds2, state.getProxyCredentials(realm2));
+ state.setProxyCredentials(realm1, null, creds1);
+ state.setProxyCredentials(realm2, null, creds2);
+ assertEquals(creds1, state.getProxyCredentials(realm1, null));
+ assertEquals(creds2, state.getProxyCredentials(realm2, null));
}
public void testHttpStateProxyNoCredentials() {
HttpState state = new HttpState();
- assertEquals(null, state.getProxyCredentials("bogus"));
+ assertEquals(null, state.getProxyCredentials("bogus", null));
}
public void testHttpStateProxyDefaultCredentials() {
HttpState state = new HttpState();
- state.setProxyCredentials(null, creds1);
- state.setProxyCredentials(realm2, creds2);
- assertEquals(creds1, state.getProxyCredentials("bogus"));
+ state.setProxyCredentials(null, null, creds1);
+ state.setProxyCredentials(realm2, null, creds2);
+ assertEquals(creds1, state.getProxyCredentials("bogus", null));
}
}
1.10 +6 -6
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttps.java
Index: TestHttps.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttps.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestHttps.java 2 Feb 2003 11:05:19 -0000 1.9
+++ TestHttps.java 5 Jul 2003 22:31:21 -0000 1.10
@@ -118,7 +118,7 @@
if (PROXY_HOST != null) {
if (PROXY_USER != null) {
HttpState state = client.getState();
- state.setProxyCredentials(null, new UsernamePasswordCredentials(
+ state.setProxyCredentials(null, null, new
UsernamePasswordCredentials(
PROXY_USER, PROXY_PASS));
}
client.getHostConfiguration().setProxy(PROXY_HOST,
Integer.parseInt(PROXY_PORT));
@@ -147,7 +147,7 @@
if (PROXY_HOST != null) {
if (PROXY_USER != null) {
HttpState state = client.getState();
- state.setProxyCredentials(null, new UsernamePasswordCredentials(
+ state.setProxyCredentials(null, null, new
UsernamePasswordCredentials(
PROXY_USER, PROXY_PASS));
}
client.getHostConfiguration().setProxy(PROXY_HOST,
Integer.parseInt(PROXY_PORT));
1.10 +5 -5
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsExternalHost.java
Index: TestMethodsExternalHost.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsExternalHost.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestMethodsExternalHost.java 7 Feb 2003 04:50:03 -0000 1.9
+++ TestMethodsExternalHost.java 5 Jul 2003 22:31:21 -0000 1.10
@@ -120,7 +120,7 @@
if (PROXY_HOST != null) {
if (PROXY_USER != null) {
HttpState state = client.getState();
- state.setProxyCredentials(null, new UsernamePasswordCredentials(
+ state.setProxyCredentials(null, null, new
UsernamePasswordCredentials(
PROXY_USER, PROXY_PASS));
}
client.getHostConfiguration().setProxy(PROXY_HOST,
Integer.parseInt(PROXY_PORT));
1.13 +10 -10
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappBasicAuth.java
Index: TestWebappBasicAuth.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappBasicAuth.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestWebappBasicAuth.java 27 Mar 2003 20:58:28 -0000 1.12
+++ TestWebappBasicAuth.java 5 Jul 2003 22:31:21 -0000 1.13
@@ -109,7 +109,7 @@
public void testSimpleAuthGet() throws Exception {
HttpClient client = createHttpClient();
- client.getState().setCredentials("BasicAuthServlet",new
UsernamePasswordCredentials("jakarta","commons"));
+ client.getState().setCredentials("BasicAuthServlet", null, new
UsernamePasswordCredentials("jakarta","commons"));
GetMethod method = new GetMethod("/" + getWebappContext() + "/auth/basic");
try {
@@ -137,7 +137,7 @@
public void testSimpleAuthPost() throws Exception {
HttpClient client = createHttpClient();
- client.getState().setCredentials("BasicAuthServlet",new
UsernamePasswordCredentials("jakarta","commons"));
+ client.getState().setCredentials("BasicAuthServlet", null, new
UsernamePasswordCredentials("jakarta","commons"));
PostMethod method = new PostMethod("/" + getWebappContext() +
"/auth/basic");
method.setRequestBody(new NameValuePair[] { new
NameValuePair("testing","one") } );
@@ -167,7 +167,7 @@
public void testSimpleAuthPut() throws Exception {
HttpClient client = createHttpClient();
- client.getState().setCredentials("BasicAuthServlet",new
UsernamePasswordCredentials("jakarta","commons"));
+ client.getState().setCredentials("BasicAuthServlet", null, new
UsernamePasswordCredentials("jakarta","commons"));
PutMethod method = new PutMethod("/" + getWebappContext() + "/auth/basic");
method.setRequestBody("testing one two three");
try {
@@ -207,7 +207,7 @@
assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth
Servlet: GET</title>") >= 0);
assertTrue(method.getResponseBodyAsString().indexOf("<p>Not
authorized.</p>") >= 0);
- client.getState().setCredentials("BasicAuthServlet",new
UsernamePasswordCredentials("jakarta","commons"));
+ client.getState().setCredentials("BasicAuthServlet", null, new
UsernamePasswordCredentials("jakarta","commons"));
method.recycle();
method.setPath("/" + getWebappContext() + "/auth/basic");
@@ -236,7 +236,7 @@
assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth
Servlet: GET</title>") >= 0);
assertTrue(method.getResponseBodyAsString().indexOf("<p>Not
authorized.</p>") >= 0);
- client.getState().setCredentials("BasicAuthServlet",new
UsernamePasswordCredentials("bad","creds"));
+ client.getState().setCredentials("BasicAuthServlet", null, new
UsernamePasswordCredentials("bad","creds"));
method.recycle();
method.setPath("/" + getWebappContext() + "/auth/basic");
@@ -255,7 +255,7 @@
HttpClient client = new HttpClient();
HttpState state = client.getState();
Credentials cred = new UsernamePasswordCredentials("jakarta", "commons");
- state.setCredentials(null, cred);
+ state.setCredentials(null, null, cred);
HostConfiguration hc = new HostConfiguration();
hc.setHost(getHost(), getPort(), getProtocol());
client.setHostConfiguration(hc);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]