Interface ExchangeHint
public interface ExchangeHint
Extra message exchange hint representation for backend services.
-
Method Summary
Modifier and TypeMethodDescriptionReturn a cache key of this hint.Return method name hint.Deprecated.Return request body.Return request headers map.Return response body.Return response headers map.int
Return response status code.boolean
Return true if the underlyingResourceResolver
should disallow caching.void
setNoCache
(boolean noCache) Set flag whether or not the underlyingResourceResolver
should disallow caching.void
setResponseBody
(Object responseBody) Set response body.void
setResponseHeaders
(Map<String, List<String>> responseHeaders) Set response headers map.void
setResponseStatusCode
(int responseStatusCode) Set response status code.
-
Method Details
-
getMethodName
String getMethodName()Return method name hint. e.g, "POST", "PUT", "DELETE", "GET", etc. for http-based backends.- Returns:
- method name hint. e.g, "POST", "PUT", "DELETE", "GET", etc. for http-based backends
-
getRequest
Deprecated.UsegetRequestHeaders()
andgetRequestBody()
instead.Return request object representation or custom request callback instance that can be understood by the underlyingResourceResolver
implementation.- Returns:
- request object representation to be understood by the underlying
ResourceResolver
implementation
-
getRequestHeaders
Return request headers map.- Returns:
- request headers map
-
getRequestBody
Object getRequestBody()Return request body.- Returns:
- request body
-
getCacheKey
Object getCacheKey()Return a cache key of this hint.- Returns:
- a cache key of this hint
-
getResponseStatusCode
int getResponseStatusCode()Return response status code.- Returns:
- response status code
-
setResponseStatusCode
void setResponseStatusCode(int responseStatusCode) Set response status code.- Parameters:
responseStatusCode
- response status code
-
getResponseHeaders
Return response headers map.- Returns:
- response headers map
-
setResponseHeaders
Set response headers map.- Parameters:
responseHeaders
- response headers map
-
getResponseBody
Object getResponseBody()Return response body. Null if the underlyingResourceResolver
doesn't set it. The type of response body depends on the underlyingResourceResolver
implementation. It could be aResource
object (mostly likely when the backend produces the same content type for both normal response and error response), byte[] or String, for example.Note: This method can be used mostly when the underlying
ResourceResolver
throws an exception instead of returning a result.- Returns:
- response body
-
setResponseBody
Set response body. The type of response body depends on the underlyingResourceResolver
implementation. It could be aResource
object (mostly likely when the backend produces the same content type for both normal response and error response), byte[] or String, for example.Note: This method can be used by the underlying
ResourceResolver
when a call on the backend returns an error, instead of a normal result.- Parameters:
responseBody
- response body
-
isNoCache
boolean isNoCache()Return true if the underlyingResourceResolver
should disallow caching.- Returns:
- true if the underlying
ResourceResolver
should disallow caching
-
setNoCache
void setNoCache(boolean noCache) Set flag whether or not the underlyingResourceResolver
should disallow caching.- Parameters:
noCache
- flag whether or not the underlyingResourceResolver
should disallow caching
-
getRequestHeaders()
andgetRequestBody()
instead.