Class ResourceRegistryResponse<T>
java.lang.Object
org.gcube.informationsystem.resourceregistry.api.client.ResourceRegistryResponse<T>
- Type Parameters:
T- payload type
Immutable successful Resource Registry response and its HTTP metadata.
- Author:
- Luca Frosini (ISTI - CNR)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumIdentifies whether an operation was served over HTTP or entirely from a client cache. -
Method Summary
Modifier and TypeMethodDescriptionbody()firstHeaderValue(String name) static <T> ResourceRegistryResponse<T>fromCache(T body) static <T> ResourceRegistryResponse<T>fromServer(T body, ResponseMetadata metadata) headers()headerValues(String name) booleanlinks()metadata()origin()intwarnings()
-
Method Details
-
fromServer
- Type Parameters:
T- body type- Parameters:
body- response bodymetadata- HTTP metadata- Returns:
- a server-backed response
-
fromCache
- Type Parameters:
T- body type- Parameters:
body- cached value- Returns:
- a cache-backed response without fabricated HTTP metadata
-
body
- Returns:
- the deserialized operation value, or
nullfor bodyless responses
-
origin
- Returns:
- whether the value originated from the server or a client cache
-
isServerResponse
public boolean isServerResponse()- Returns:
truewhen HTTP metadata is available
-
statusCode
public int statusCode()- Returns:
- HTTP status code @throws IllegalStateException for cache-backed values
-
headers
- Returns:
- immutable response headers, or an empty map for cache-backed values
-
headerValues
- Parameters:
name- header name- Returns:
- immutable header values
-
firstHeaderValue
- Parameters:
name- header name- Returns:
- first header value, when present
-
metadata
- Returns:
- HTTP metadata, empty for a cache-backed value
-
links
- Returns:
- all
Linkresponse header values
-
contentLocation
- Returns:
- the
Content-Locationvalue, when present
-
preferenceApplied
- Returns:
- the
Preference-Appliedvalue, when present
-
warnings
- Returns:
- all
X-Warningvalues
-
resultScopes
- Returns:
- recognized immutable
X-Result-Scopevalues
-