Annotation Interface HttpExchange
An HTTP service interface can be passed to
 HttpServiceProxyFactory
 to create a client proxy. It can also be implemented by an
 @Controller for server
 handling. For more details in comparison to @RequestMapping, see the
 reference docs.
 
Supported at the type level to express common attributes, to be inherited
 by all methods, such as a base URL path. At the method level, it's more common
 to use one of the following HTTP method specific, shortcut annotations, each
 of which is itself meta-annotated with HttpExchange:
 
Supported method arguments:
| Method Argument | Description | Resolver | 
|---|---|---|
URI | 
 Dynamically set the URL for the request, overriding the annotation's
 url() attribute | 
 UrlArgumentResolver | 
 
UriBuilderFactory | 
 Dynamically set the base URI for the request, overriding the
 one from the annotation's url() attribute, while keeping the
 subsequent path segments as defined there | 
 UriBuilderFactoryArgumentResolver | 
 
HttpMethod | 
 Dynamically set the HTTP method for the request, overriding the annotation's
 method() attribute | 
 HttpMethodArgumentResolver | 
 
@RequestHeader | 
 Add a request header | RequestHeaderArgumentResolver | 
 
@PathVariable | 
 Add a path variable for the URI template | PathVariableArgumentResolver | 
 
@RequestBody | 
 Set the body of the request | RequestBodyArgumentResolver | 
 
@RequestParam | 
 Add a request parameter, either form data if "Content-Type" is
 "application/x-www-form-urlencoded" or query params otherwise | 
 RequestParamArgumentResolver | 
 
@RequestPart | 
 Add a request part, which may be a String (form field),
 Resource (file part), Object (entity to be
 encoded, for example, as JSON), HttpEntity (part content and headers), a
 Part, or a
 Publisher of any of the above.
 ( | 
 RequestPartArgumentResolver | 
 
@CookieValue | 
 Add a cookie | CookieValueArgumentResolver | 
 
- Since:
 - 6.0
 - Author:
 - Rossen Stoyanchev
 
- 
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]The media types for the"Accept"header.The media type for the"Content-Type"header.String[]The additional headers to use, as an array ofname=valuepairs.The HTTP method to use.The URL for the request, either a full URL or a path only that is relative to a URL declared in a type-level@HttpExchange, and/or a globally configured base URL.This is an alias forurl(). 
- 
Element Details
- 
value
This is an alias forurl().- Default:
 - ""
 
 - 
url
The URL for the request, either a full URL or a path only that is relative to a URL declared in a type-level@HttpExchange, and/or a globally configured base URL.By default, this is empty.
- Default:
 - ""
 
 - 
method
String methodThe HTTP method to use.Supported at the type level as well as at the method level. When used at the type level, all method-level mappings inherit this value.
By default, this is empty.
- Default:
 - ""
 
 - 
contentType
String contentTypeThe media type for the"Content-Type"header.Supported at the type level as well as at the method level, in which case the method-level values override type-level values.
By default, this is empty.
- Default:
 - ""
 
 - 
accept
String[] acceptThe media types for the"Accept"header.Supported at the type level as well as at the method level, in which case the method-level values override type-level values.
By default, this is empty.
- Default:
 - {}
 
 - 
headers
String[] headersThe additional headers to use, as an array ofname=valuepairs.Multiple comma-separated values are accepted, and placeholders are supported in these values. However, Accept and Content-Type headers are ignored: see
accept()andcontentType().Supported at the type level as well as at the method level, in which case the method-level values override type-level values.
By default, this is empty.
- Since:
 - 6.2
 
- Default:
 - {}
 
 
 -