SPR-7494 - Introduce interceptors for RestTemplate

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3929 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Arjen Poutsma 2011-01-28 09:17:00 +00:00
parent 26c92551dd
commit 57f23ae761
3 changed files with 48 additions and 33 deletions

View File

@ -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();
}

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,10 +17,10 @@
package org.springframework.http.client; package org.springframework.http.client;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpOutputMessage; import org.springframework.http.HttpOutputMessage;
import org.springframework.http.HttpRequest;
/** /**
* Represents a client-side HTTP request. Created via an implementation of the {@link ClientHttpRequestFactory}. * 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 * @since 3.0
* @see ClientHttpRequestFactory#createRequest(java.net.URI, HttpMethod) * @see ClientHttpRequestFactory#createRequest(java.net.URI, HttpMethod)
*/ */
public interface ClientHttpRequest extends HttpOutputMessage { public interface ClientHttpRequest extends HttpRequest, 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();
/** /**
* Execute this request, resulting in a {@link ClientHttpResponse} that can be read. * Execute this request, resulting in a {@link ClientHttpResponse} that can be read.

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,10 +16,8 @@
package org.springframework.http.server; package org.springframework.http.server;
import java.net.URI;
import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpRequest;
/** /**
* Represents a server-side HTTP request. * Represents a server-side HTTP request.
@ -27,19 +25,6 @@ import org.springframework.http.HttpMethod;
* @author Arjen Poutsma * @author Arjen Poutsma
* @since 3.0 * @since 3.0
*/ */
public interface ServerHttpRequest extends HttpInputMessage { public interface ServerHttpRequest extends HttpRequest, 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();
} }