public class ConfigurationContext extends Object
Modifier and Type | Method and Description |
---|---|
static ConfigurationContext |
empty()
Creates a context in which no configuration is desired.
|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this configuration context.
|
URI |
get()
If a configuration is present in this
ConfigurationContext , returns the value,
otherwise throws NoSuchElementException . |
int |
hashCode()
Returns the hash code value of the present configuration, if any, or 0 (zero) if
no configuration is present.
|
boolean |
isPresent()
Return
true if there is a configuration present, otherwise false . |
static ConfigurationContext |
of(HttpServletRequest request,
HttpServletResponse response)
Creates a context as specified in the provided servlet request.
|
static ConfigurationContext |
of(URI configuration)
Creates a context for the specified configuration.
|
String |
toString()
Returns a non-empty string representation of this Optional suitable for
debugging.
|
public static ConfigurationContext empty()
public static ConfigurationContext of(URI configuration)
configuration
- the configuration.public static ConfigurationContext of(HttpServletRequest request, HttpServletResponse response)
The configuration can be set in one of two ways:
oslc_config.context
query parameter.
<http://myServer.myConfiguration>
)
Configuration-Context
header.
Vary=Configuration-Context
header in the servlet response,
so that the client does not cache the request based only on the request URL.
request
- the servlet request.response
- the servlet response.WebApplicationException
- if the configuration set is not a valid URI or
if both oslc_config.context
query parameter and Configuration-Context
header
are referencing different configurations.public int hashCode()
public boolean equals(Object obj)
ConfigurationContext
and;
public boolean isPresent()
true
if there is a configuration present, otherwise false
.true
if there is a configuration present, otherwise false
public URI get()
ConfigurationContext
, returns the value,
otherwise throws NoSuchElementException
.Optional
NoSuchElementException
- if there is no configuration presentisPresent()