Package com.sodius.oslc.server.config
Class ConfigContexts
- java.lang.Object
-
- com.sodius.oslc.server.config.ConfigContexts
-
public class ConfigContexts extends Object
Determines the configuration context of a request. The configuration context controls which version of a resource is desired. The context may be empty, in which case the request is not made for a particular configuration and it's up to the server to determine which version of the resource to return- Since:
- 3.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConfigContext
of(HttpServletRequest request, HttpServletResponse response)
Creates a context as specified in the provided servlet request.
-
-
-
Method Detail
-
of
public static ConfigContext of(HttpServletRequest request, HttpServletResponse response)
Creates a context as specified in the provided servlet request.The configuration can be set in one of two ways:
- Using an
oslc_config.context
query parameter.
The configuration URI is expected to be angle bracket-delimited (e.g.<http://myServer.myConfiguration>
)
- Using a
Configuration-Context
header.
In this case this method adds aVary=Configuration-Context
header in the servlet response, so that the client does not cache the request based only on the request URL.
- Parameters:
request
- the servlet request.response
- the servlet response.- Returns:
- the configuration context wrapping the configuration specified in the request, or an empty context if not configuration is set.
- Throws:
WebApplicationException
- if the configuration set is not a valid URI or if bothoslc_config.context
query parameter andConfiguration-Context
header are referencing different configurations.
- Using an
-
-