Class ResultScopeHeaderEmitter
java.lang.Object
org.gcube.informationsystem.resourceregistry.http.headers.scope.ResultScopeHeaderEmitter
Emits a single
X-Result-Scope header combining all accumulated ResultScope
tokens as a comma-separated list, in canonical (enum declaration) order.
Unlike X-Warning, which emits one header line per warning with anti-DoS capping
(an open-ended, user-influenced cardinality), X-Result-Scope is bounded to a fixed,
small enum, so a single combined header with no capping is sufficient.
- Author:
- Luca Frosini (ISTI - CNR)
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddResultScopeHeader(jakarta.ws.rs.core.MultivaluedMap<String, Object> headers, Set<org.gcube.informationsystem.resourceregistry.api.rest.ResultScope> scopes) Emits theX-Result-Scopeheader into the given JAX-RS multivalued map, if non-empty.static voidaddResultScopeHeader(jakarta.ws.rs.core.Response.ResponseBuilder rb, Set<org.gcube.informationsystem.resourceregistry.api.rest.ResultScope> scopes) Emits theX-Result-Scopeheader into the given response builder, if non-empty.static StringtoHeaderValue(Set<org.gcube.informationsystem.resourceregistry.api.rest.ResultScope> scopes) Formats the accumulated scopes as the comma-separated header value, in canonical (enum declaration) order regardless of the order scopes were added in.
-
Method Details
-
addResultScopeHeader
public static void addResultScopeHeader(jakarta.ws.rs.core.Response.ResponseBuilder rb, Set<org.gcube.informationsystem.resourceregistry.api.rest.ResultScope> scopes) Emits theX-Result-Scopeheader into the given response builder, if non-empty.- Parameters:
rb- the response builder to add the header toscopes- the accumulated result scopes
-
addResultScopeHeader
public static void addResultScopeHeader(jakarta.ws.rs.core.MultivaluedMap<String, Object> headers, Set<org.gcube.informationsystem.resourceregistry.api.rest.ResultScope> scopes) Emits theX-Result-Scopeheader into the given JAX-RS multivalued map, if non-empty.- Parameters:
headers- the multivalued headers map to add the header toscopes- the accumulated result scopes
-
toHeaderValue
public static String toHeaderValue(Set<org.gcube.informationsystem.resourceregistry.api.rest.ResultScope> scopes) Formats the accumulated scopes as the comma-separated header value, in canonical (enum declaration) order regardless of the order scopes were added in.- Parameters:
scopes- the accumulated result scopes- Returns:
- the formatted header value, or
nullifscopesis null/empty
-