You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ma...@apache.org on 2002/02/22 20:24:24 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods UrlDeleteMethod.java UrlGetMethod.java UrlHeadMethod.java UrlOptionsMethod.java UrlPostMethod.java UrlPutMethod.java
marcsaeg 02/02/22 11:24:24
Added: httpclient/src/java/org/apache/commons/httpclient
HttpConnectionManager.java HttpMultiClient.java
HttpRecoverableException.java HttpSharedState.java
HttpUrlMethod.java
httpclient/src/java/org/apache/commons/httpclient/methods
UrlDeleteMethod.java UrlGetMethod.java
UrlHeadMethod.java UrlOptionsMethod.java
UrlPostMethod.java UrlPutMethod.java
Log:
Adding new files for HttpMultiClient, HttpUrlMethod and
HttpRecoverableException.
Revision Changes Path
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnectionManager.java
Index: HttpConnectionManager.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnectionManager.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
import org.apache.commons.httpclient.log.*;
/**
* Manages a set of HttpConnections for various host:ports. This class is
* used by HttpMultiClient.
*
* @author Marc A. Saegesser
*/
public class HttpConnectionManager
{
// -------------------------------------------------------- Class Variables
static private final Log log = LogSource.getInstance("org.apache.commons.httpclient.HttpConnectionManager");
// ----------------------------------------------------- Instance Variables
private HashMap mapHosts = new HashMap();
private HashMap mapNumConnections = new HashMap();
private int maxConnections = 2; // Per RFC 2616 sec 8.1.4
private String proxyHost = null;
private int proxyPort = -1;
/**
* No-args constructor
*/
public HttpConnectionManager()
{
}
/**
* Set the proxy host to use for all connections.
*
* @param proxyHost - the proxy host name
*/
public void setProxyHost(String proxyHost)
{
this.proxyHost = proxyHost;
}
/**
* Get the proxy host.
*
* @return the proxy host name
*/
public String getProxyHost()
{
return proxyHost;
}
/**
* Set the proxy port to use for all connections.
*
* @param proxyPort - the proxy port number
*/
public void setProxyPort(int proxyPort)
{
this.proxyPort = proxyPort;
}
/**
* Get the proxy port number.
*
* @return the proxy port number
*/
public int getProxyPort()
{
return proxyPort;
}
/**
* Set the maximum number of connections allowed for a given host:port.
* Per RFC 2616 section 8.1.4, this value defaults to 2.
*
* @param maxConnections - number of connections allowed for each host:port
*/
public void setMaxConnectionsPerHost(int maxConnections)
{
this.maxConnections = maxConnections;
}
/**
* Get the maximum number of connections allowed for a given host:port.
*
* @return The maximum number of connections allowed for a given host:port.
*/
public int getMaxConnectionsPerHost()
{
return maxConnections;
}
/**
* Get an HttpConnection for a given URL. The URL must be fully
* specified (i.e. contain a protocol and a host (and optional port number).
* If the maximum number of connections for the host has been reached, this
* method will block until a connection becomes available.
*
* @param sURL - a fully specified URL.
* @return an HttpConnection for the given host:port
* @exception java.net.MalformedURLException
*/
public HttpConnection getConnection(String sURL) throws MalformedURLException
{
HttpConnection conn = null;
URL url = null;
try{
url = new URL(sURL);
}catch(MalformedURLException e){
log.error("HttpConnectionManager.getConnection: Invalid url '" + sURL + "'. Exception = " + e.toString());
throw e;
}
// Get the protocol and port (use default port if not specified)
String protocol = url.getProtocol();
String host = url.getHost();
int port = url.getPort();
boolean isSecure = protocol.equalsIgnoreCase("HTTPS");
if(port == -1){
if(isSecure){
port = 443;
}else{
port = 80;
}
}
String key = host + ":" + port;
// Look for a list of connections for the given host:port
LinkedList listConnections = null;
synchronized(mapHosts){
listConnections = (LinkedList)mapHosts.get(key);
if(listConnections == null){
// First time for this host:port
listConnections = new LinkedList();
mapHosts.put(key, listConnections);
mapNumConnections.put(key, new Integer(1));
}
}
//
synchronized(listConnections){
if(listConnections.size() > 0){
conn = (HttpConnection)listConnections.removeFirst();
}else{
Integer numConnections = (Integer)mapNumConnections.get(key);
if(numConnections == null){
log.error("HttpConnectionManager.getConnection: No connection count for " + key);
// This should never happen, but just in case we'll try to recover.
numConnections = new Integer(0);
mapNumConnections.put(key, numConnections);
}
if(numConnections.intValue() < maxConnections){
// Create a new connection
if(log.isDebugEnabled()){
log.debug("HttpConnectionManager.getConnection: creating connection for " + host + ":" + port + " via " + proxyHost + ":" + proxyPort);
}
conn = new HttpConnection(proxyHost, proxyPort, host, port, isSecure);
numConnections = new Integer(numConnections.intValue()+1);
mapNumConnections.put(key, numConnections);
}else{
// Wait for a connection to be available
while(conn == null){ // spin lock
try{
log.debug("HttpConnectionManager.getConnection: waiting for connection for " + host + ":" + port);
listConnections.wait();
}catch(InterruptedException e){
log.debug("HttpConnectionManager.getConnection: Interrupted.");
}
if(listConnections.size() > 0){
conn = (HttpConnection)listConnections.removeFirst();
}
}
}
}
}
return conn;
}
/**
* Make the given HttpConnection available for use by other requests.
* If another thread is blocked in getConnection() waiting for a connection
* for this host:port, they will be woken up.
*
* @param conn - The HttpConnection to make available.
*/
public void releaseConnection(HttpConnection conn)
{
String host = conn.getHost();
int port = conn.getPort();
String key = host + ":" + port;
if(log.isDebugEnabled()){
log.debug("HttpConnectionManager.releaseConnection: Release connection for " + host + ":" + port);
}
LinkedList listConnections = null;
synchronized(mapHosts){
listConnections = (LinkedList)mapHosts.get(key);
if(listConnections == null){
// This is an error, but we'll try to recover
log.error("HttpConnectionManager.releaseConnection: No connect list for " + key);
listConnections = new LinkedList();
mapHosts.put(key, listConnections);
mapNumConnections.put(key, new Integer(1));
}
}
synchronized(listConnections){
// Put the connect back in the available list and notify a waiter
listConnections.addFirst(conn);
listConnections.notify();
}
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMultiClient.java
Index: HttpMultiClient.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMultiClient.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient;
import java.io.IOException;
import org.apache.commons.httpclient.log.*;
/**
* An Http user-agent that supports multiple connections
* to Http servers.
*
* @author Marc A. Saegesser
*/
public class HttpMultiClient
{
// -------------------------------------------------------- Class Variables
static private final Log log = LogSource.getInstance("org.apache.commons.httpclient.HttpMultiClient");
// ----------------------------------------------------- Instance Variables
private HttpSharedState state = null;
private HttpConnectionManager mgr = new HttpConnectionManager();
private boolean strictMode = true;
// ----------------------------------------------------------- Constructors
/**
* No-args constructor.
*/
public HttpMultiClient()
{
}
/**
* Set the shared state.
*
* @param state - the new shared state
*/
public void setState(HttpSharedState state)
{
this.state = state;
}
/**
* Get the shared state
*
* @return the shared state
*/
public HttpSharedState getState()
{
if(state == null){
state = new HttpSharedState();
}
return state;
}
/**
*
*/
public void setStrictMode(boolean strictMode)
{
this.strictMode = strictMode;
}
/**
*
*/
public boolean isStrictMode()
{
return strictMode;
}
/**
* Execute the given {@link HttpMethod} using my current
* {@link HttpConnection connection} and {@link HttpState}.
*
* @param method the {@link HttpMethod} to execute
* @return the method's response code
*
* @throws IOException if an I/O error occurs
* @throws HttpException if a protocol exception occurs
*/
public int executeMethod(HttpUrlMethod method) throws IOException, HttpException
{
HttpConnection connection = mgr.getConnection(method.getUrl());
int status = 0;
method.setStrictMode(strictMode);
status = method.execute(getState(),connection);
mgr.releaseConnection(connection);
if(status == 301 || status == 302 ||
status == 303 || status == 307){
Header header = method.getResponseHeader("Location");
String url = header.getValue();
if(url == null){
log.error("HttpMultiClient.executeMethod: Received redirect without Location header.");
throw new HttpException("Received redirect without Location header.");
}
method.recycle();
method.setUrl(url);
return executeMethod(method);
}
return status;
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java
Index: HttpRecoverableException.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient;
/**
* <p>
* Signals that an HTTP or HTTP Client exception has occurred. This
* exception may have been caused by a transient error and the request
* may be retried.
* </p>
* @version $Revision: 1.1 $ $Date: 2002/02/22 19:24:23 $
*/
public class HttpRecoverableException extends HttpException {
public HttpRecoverableException() {
super();
}
public HttpRecoverableException(String message) {
super(message);
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpSharedState.java
Index: HttpSharedState.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpSharedState.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient;
import java.util.Date;
/**
* HttpSharedState provides synchronized access to HttpState so
* that the state can be used in calls to HttpMultiClient.executeMethod()
* on multiple threads.
*
* @author Marc A. Saegesser
*/
public class HttpSharedState extends HttpState
{
/**
* No-args constructor.
*/
public HttpSharedState()
{
super();
}
/**
* Synchronizes HttpState.addCookie().
*
* @param cookie - the Cookie to add.
*/
public synchronized void addCookie(Cookie cookie)
{
super.addCookie(cookie);
}
/**
* Synchronizes HttpState.addCookies().
*
* @param newCookies - an array of cookies to add.
*/
public void addCookies(Cookie[] newCookies)
{
super.addCookies(newCookies);
}
/**
* Synchronizes HttpState.getCookies().
*
* @return an array containing all the cookies
*/
public Cookie[] getCookies()
{
return super.getCookies();
}
/**
* Synchronizes HttpState.getCookies().
*
* @return all cookies matching the given parameters.
*/
public synchronized Cookie[] getCookies(String domain, int port, String path, boolean secure, Date now)
{
return super.getCookies(domain, port, path, secure, now);
}
/**
* Synchronizes HttpState.purgeExpiredCookies(Date).
*
* @param date - purge cookies prior to this date.
* @return true if at least one cookie was purged.
*/
public synchronized boolean purgeExpiredCookies(Date date)
{
return super.purgeExpiredCookies(date);
}
/**
* Synchronizes HttpState.setCredentials().
*
* @param realm - the authentication realm
* @param credentials - the authentication credentials
*/
public void setCredentials(String realm, Credentials credentials)
{
super.setCredentials(realm, credentials);
}
/**
* Synchronizes HttpState.getCredentials().
*
* @param realm - the authorization realm.
* @return the authorizations credentials for the given realm
*/
public Credentials getCredentials(String realm)
{
return super.getCredentials(realm);
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java
Index: HttpUrlMethod.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient;
import java.net.MalformedURLException;
/**
* HttpUrlMethod extends HttpMethod. HttpMethod only contains
* the path portion of a URL and gets the host:port from the connection
* maintained in HttpCleint. HttpUrlMethod is initialized with a fully
* specified URL and is used with HttpMultiClient. HttpMultiClient
* chooses the appropriate HttpConnectoin (via HttpConnectionManager)
* based on the host and port in the URL.
*
* @author Marc A. Saegesser
*/
public interface HttpUrlMethod extends HttpMethod
{
/**
* Sets the URL.
*
* @param url - the URL for this request.
*/
public void setUrl(String url) throws MalformedURLException;
/**
* Returns this request's URL.
*
* @return the request's URL.
*/
public String getUrl();
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
Index: UrlDeleteMethod.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient.methods;
import java.net.URL;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.HttpUrlMethod;
import org.apache.commons.httpclient.URIUtil;
/**
* HttpUrlMethod version of DeleteMethod.
*
* @author Marc A. Saegesser
*/
public class UrlDeleteMethod extends DeleteMethod implements HttpUrlMethod
{
// ----------------------------------------------------- Instance Variables
private String url;
/**
* No-arg constructor.
*/
public UrlDeleteMethod() {
super();
}
/**
* Path-setting constructor.
* @param path the path to request
*/
public UrlDeleteMethod(String url) throws MalformedURLException {
super(URIUtil.getPath(url));
}
/**
*
*/
public void setUrl(String url) throws MalformedURLException
{
setPath(URIUtil.getPath(url));
this.url = url;
}
/**
*
*/
public String getUrl()
{
return url;
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java
Index: UrlGetMethod.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient.methods;
import java.util.Date;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.HttpUrlMethod;
import org.apache.commons.httpclient.URIUtil;
/**
* Implements the URL version of GetMethod. It serves the
* same purpose as GetMethod but it takes URL instead of
* a path.
*
* @author Marc A. Saegesser
*/
public class UrlGetMethod extends GetMethod implements HttpUrlMethod
{
// ----------------------------------------------------- Instance Variables
private String url;
/**
* No-arg constructor.
*/
public UrlGetMethod()
{
super();
}
/**
*
*/
public UrlGetMethod(String url) throws MalformedURLException
{
super(URIUtil.getPath(url));
this.url = url;
}
public UrlGetMethod(String url, String tempDir) throws MalformedURLException
{
super(URIUtil.getPath(url), tempDir);
}
/**
* Constructor.
* @param path the path to request
* @param tempDir the directory in which to store temporary files
* @param tempFile the file (under tempDir) to buffer contents to
* @exception java.net.MalformedURLException
*/
public UrlGetMethod(String url, String tempDir, String tempFile) throws MalformedURLException
{
super(URIUtil.getPath(url), tempDir, tempFile);
}
/**
* Constructor.
* @param path the path to request
* @param tempFile the file to buffer contents to
* @exception java.net.MalformedURLException
*/
public UrlGetMethod(String url, File fileData) throws MalformedURLException
{
super(URIUtil.getPath(url), fileData);
}
/**
* Set the URL for this method.
* @param url - a fully specified URL
*/
public void setUrl(String url) throws MalformedURLException
{
super.setPath(URIUtil.getPath(url));
this.url = url;
}
/**
* Get the URL
* @return the url
*/
public String getUrl()
{
return url;
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
Index: UrlHeadMethod.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient.methods;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.URIUtil;
import org.apache.commons.httpclient.HttpUrlMethod;
/**
* HttpUrlMethod version of HeadMethod.
*
* @author Marc A. Saegesser
*/
public class UrlHeadMethod extends HeadMethod implements HttpUrlMethod
{
// ----------------------------------------------------- Instance Variables
private String url;
/**
* No-arg constructor.
*/
public UrlHeadMethod() {
super();
}
/**
* Path-setting constructor.
* @param path the path to request
*/
public UrlHeadMethod(String url) throws MalformedURLException
{
super(URIUtil.getPath(url));
}
/**
* Set the URL for this method.
* @param url - a fully specified URL
*/
public void setUrl(String url) throws MalformedURLException
{
super.setPath(URIUtil.getPath(url));
this.url = url;
}
/**
* Get the URL
* @return the url
*/
public String getUrl()
{
return url;
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
Index: UrlOptionsMethod.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient.methods;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.URIUtil;
import org.apache.commons.httpclient.HttpUrlMethod;
/**
* HttpUrlMethod version of Options method.
*
* @author Marc A. Saegesser
*/
public class UrlOptionsMethod extends OptionsMethod implements HttpUrlMethod
{
// ----------------------------------------------------- Instance Variables
private String url;
/**
* No-arg constructor.
*/
public UrlOptionsMethod() {
super();
}
/**
* Path-setting constructor.
* @param path the path to request
*/
public UrlOptionsMethod(String url) throws MalformedURLException
{
super(URIUtil.getPath(url));
}
/**
* Set the URL for this method.
* @param url - a fully specified URL
*/
public void setUrl(String url) throws MalformedURLException
{
super.setPath(URIUtil.getPath(url));
this.url = url;
}
/**
* Get the URL
* @return the url
*/
public String getUrl()
{
return url;
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java
Index: UrlPostMethod.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient.methods;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.HttpUrlMethod;
import org.apache.commons.httpclient.URIUtil;
/**
* HttpUrlMethod version of PostMethod.
*
* @author Marc A. Saegesser
*/
public class UrlPostMethod extends PostMethod implements HttpUrlMethod
{
// ----------------------------------------------------- Instance Variables
private String url;
/**
* No-arg constructor.
*/
public UrlPostMethod()
{
super();
}
/**
* Path-setting constructor.
* @param url the URL to request
* @exception java.net.MalformedURLException
*/
public UrlPostMethod(String url) throws MalformedURLException
{
super(URIUtil.getPath(url));
}
/**
* Constructor.
* @param url the URL to request
* @param tempDir directory to store temp files in
* @exception java.net.MalformedURLException
*/
public UrlPostMethod(String url, String tempDir) throws MalformedURLException
{
super(URIUtil.getPath(url), tempDir);
}
/**
* Constructor.
* @param url the URL to request
* @param tempDir directory to store temp files in
* @param tempFile file to store temporary data in
* @exception java.net.MalformedURLException
*/
public UrlPostMethod(String url, String tempDir, String tempFile) throws MalformedURLException
{
super(URIUtil.getPath(url), tempDir, tempFile);
}
/**
* Sets the request's URL.
*
* @param url the URL for the request
* @exception java.net.MalformedURLException
*/
public void setUrl(String url) throws MalformedURLException
{
super.setPath(URIUtil.getPath(url));
this.url = url;
}
/**
*
*/
public String getUrl()
{
return url;
}
}
1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java
Index: UrlPutMethod.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
* $Revision: 1.1 $
* $Date: 2002/02/22 19:24:23 $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "HttpClient", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient.methods;
import java.net.URL;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.HttpUrlMethod;
import org.apache.commons.httpclient.URIUtil;
/**
* HttpUrlMethod version of PutMethod.
*
* @author Marc A. Saegesser
*/
public class UrlPutMethod extends PutMethod implements HttpUrlMethod
{
// ----------------------------------------------------- Instance Variables
private String url;
/**
* No-arg constructor.
*/
public UrlPutMethod() {
super();
}
/**
* Path-setting constructor.
* @param path the path to request
*/
public UrlPutMethod(String url) throws MalformedURLException {
super(URIUtil.getPath(url));
}
/**
*
*/
public void setUrl(String url) throws MalformedURLException
{
setPath(URIUtil.getPath(url));
this.url = url;
}
/**
*
*/
public String getUrl()
{
return url;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>