You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2005/03/27 15:45:13 UTC

svn commit: r159146 - in jakarta/httpclient/trunk/http-common/src/java/org/apache/http: HttpMutableRequest.java HttpMutableResponse.java impl/BasicHttpRequest.java impl/BasicHttpResponse.java impl/HttpGetRequest.java

Author: olegk
Date: Sun Mar 27 05:45:12 2005
New Revision: 159146

URL: http://svn.apache.org/viewcvs?view=rev&rev=159146
Log:
Added HttpMutableRequest and HttpMutableResponse interfaces

Added:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java   (with props)
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java   (with props)
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java   (with props)
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java   (with props)
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java   (with props)

Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java?view=auto&rev=159146
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java Sun Mar 27 05:45:12 2005
@@ -0,0 +1,45 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ *  Copyright 1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * 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/>.
+ *
+ */
+
+package org.apache.http;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ * 
+ * @since 4.0
+ */
+public interface HttpMutableRequest extends HttpRequest, HttpMutableMessage {
+
+    void setRequestLine(RequestLine requestline);
+    
+}

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableRequest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java?view=auto&rev=159146
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java Sun Mar 27 05:45:12 2005
@@ -0,0 +1,47 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ *  Copyright 1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * 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/>.
+ *
+ */
+
+package org.apache.http;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ * 
+ * @since 4.0
+ */
+public interface HttpMutableResponse extends HttpMutableMessage, HttpResponse {
+
+    void setStatusLine(StatusLine statusline);
+
+    void setEntity(HttpEntity entity);
+    
+}

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java?view=auto&rev=159146
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java Sun Mar 27 05:45:12 2005
@@ -0,0 +1,87 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ *  Copyright 1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * 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/>.
+ *
+ */
+
+package org.apache.http.impl;
+
+import org.apache.http.HttpMutableRequest;
+import org.apache.http.HttpVersion;
+import org.apache.http.RequestLine;
+import org.apache.http.params.HttpProtocolParams;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ * 
+ * @since 4.0
+ */
+public class BasicHttpRequest extends BasicHttpMessage implements HttpMutableRequest {
+    
+    private String method = null;
+    private String uri = null;
+    private RequestLine requestline = null;
+    
+    protected BasicHttpRequest(final String method, final String uri) {
+        super();
+        if (method == null) {
+            throw new IllegalArgumentException("Method name may not be null");
+        }
+        if (uri == null) {
+            throw new IllegalArgumentException("Request URI may not be null");
+        }
+        this.method = method;
+        this.uri = uri;
+    }
+
+    protected BasicHttpRequest(final RequestLine requestline) {
+        super();
+        setRequestLine(requestline);
+    }
+
+    public RequestLine getRequestLine() {
+        if (this.requestline != null) {
+            return this.requestline;
+        } else {
+            HttpVersion ver = new HttpProtocolParams(getParams()).getVersion();
+            return new RequestLine(this.method, this.uri, ver);
+        }
+    }
+
+    public void setRequestLine(final RequestLine requestline) {
+        if (requestline == null) {
+            throw new IllegalArgumentException("Request line may not be null");
+        }
+        this.requestline = requestline;
+        this.method = requestline.getMethod();
+        this.uri = requestline.getUri();
+    }
+    
+}

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpRequest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java?view=auto&rev=159146
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java Sun Mar 27 05:45:12 2005
@@ -0,0 +1,72 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ *  Copyright 1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * 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/>.
+ *
+ */
+
+package org.apache.http.impl;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpMutableResponse;
+import org.apache.http.StatusLine;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ * 
+ * @since 4.0
+ */
+public class BasicHttpResponse extends BasicHttpMessage implements HttpMutableResponse {
+    
+    private StatusLine statusline = null;
+    
+    protected BasicHttpResponse(final StatusLine statusline) {
+        super();
+        setStatusLine(statusline);
+    }
+
+    public StatusLine getStatusLine() {
+        return this.statusline; 
+    }
+
+    public void setStatusLine(final StatusLine statusline) {
+        if (statusline == null) {
+            throw new IllegalArgumentException("Status line may not be null");
+        }
+        this.statusline = statusline;
+    }
+    
+    public HttpEntity getEntity() {
+        return null;
+    }
+    
+    public void setEntity(final HttpEntity entity) {
+    }
+    
+}

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/BasicHttpResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java?view=auto&rev=159146
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java Sun Mar 27 05:45:12 2005
@@ -0,0 +1,49 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ *  Copyright 1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * 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/>.
+ *
+ */
+
+package org.apache.http.impl;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ * 
+ * @since 4.0
+ */
+public class HttpGetRequest extends BasicHttpRequest {
+
+    public static String METHOD_NAME = "GET";
+    
+    public HttpGetRequest(final String uri) {
+        super(METHOD_NAME, uri);
+    }
+    
+}

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/HttpGetRequest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain