diff --git a/org.springframework.web/src/main/java/org/springframework/http/HttpRequest.java b/org.springframework.web/src/main/java/org/springframework/http/HttpRequest.java new file mode 100644 index 0000000000..b84df266de --- /dev/null +++ b/org.springframework.web/src/main/java/org/springframework/http/HttpRequest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * 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. + */ + +package org.springframework.http; + +import java.net.URI; + +/** + * Represents an HTTP request message, consisting of {@linkplain #getMethod() method} + * and {@linkplain #getURI() uri}. + * + * @author Arjen Poutsma + * @since 3.1 + */ +public interface HttpRequest extends HttpMessage { + + /** + * Return the HTTP method of the request. + * @return the HTTP method as an HttpMethod enum value + */ + HttpMethod getMethod(); + + /** + * Return the URI of the request. + * @return the URI of the request + */ + URI getURI(); + +} diff --git a/org.springframework.web/src/main/java/org/springframework/http/client/ClientHttpRequest.java b/org.springframework.web/src/main/java/org/springframework/http/client/ClientHttpRequest.java index ec3549ff8c..e8681d5041 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/client/ClientHttpRequest.java +++ b/org.springframework.web/src/main/java/org/springframework/http/client/ClientHttpRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,10 @@ package org.springframework.http.client; import java.io.IOException; -import java.net.URI; import org.springframework.http.HttpMethod; import org.springframework.http.HttpOutputMessage; +import org.springframework.http.HttpRequest; /** * Represents a client-side HTTP request. Created via an implementation of the {@link ClientHttpRequestFactory}. @@ -32,19 +32,7 @@ import org.springframework.http.HttpOutputMessage; * @since 3.0 * @see ClientHttpRequestFactory#createRequest(java.net.URI, HttpMethod) */ -public interface ClientHttpRequest extends HttpOutputMessage { - - /** - * Return the HTTP method of the request. - * @return the HTTP method as an HttpMethod enum value - */ - HttpMethod getMethod(); - - /** - * Return the URI of the request. - * @return the URI of the request - */ - URI getURI(); +public interface ClientHttpRequest extends HttpRequest, HttpOutputMessage { /** * Execute this request, resulting in a {@link ClientHttpResponse} that can be read. diff --git a/org.springframework.web/src/main/java/org/springframework/http/server/ServerHttpRequest.java b/org.springframework.web/src/main/java/org/springframework/http/server/ServerHttpRequest.java index 8896aa833e..ce8fcd3ad2 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/server/ServerHttpRequest.java +++ b/org.springframework.web/src/main/java/org/springframework/http/server/ServerHttpRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,8 @@ package org.springframework.http.server; -import java.net.URI; - import org.springframework.http.HttpInputMessage; -import org.springframework.http.HttpMethod; +import org.springframework.http.HttpRequest; /** * Represents a server-side HTTP request. @@ -27,19 +25,6 @@ import org.springframework.http.HttpMethod; * @author Arjen Poutsma * @since 3.0 */ -public interface ServerHttpRequest extends HttpInputMessage { - - /** - * Return the HTTP method of the request. - * @return the HTTP method as an HttpMethod enum value - */ - HttpMethod getMethod(); - - /** - * Return the URI of the request. - * @return the URI of the request - */ - URI getURI(); - +public interface ServerHttpRequest extends HttpRequest, HttpInputMessage { }