Package com.sodius.oslc.server.config
Class ConfigContexts
java.lang.Object
com.sodius.oslc.server.config.ConfigContexts
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
Modifier and TypeMethodDescriptionstatic ConfigContextof(HttpServletRequest request) Equivalent toof(HttpServletRequest, HttpServletResponse)but without support to set theVaryheader.static ConfigContextof(HttpServletRequest request, HttpServletResponse response) Creates a context as specified in the provided servlet request.
-
Method Details
-
of
Creates a context as specified in the provided servlet request.The configuration can be set in one of two ways:
- Using an
oslc_config.contextquery parameter.
The configuration URI is expected to be angle bracket-delimited (e.g.<http://myServer.myConfiguration>)
- Using a
Configuration-Contextheader.
In this case this method adds aVary=Configuration-Contextheader 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.contextquery parameter andConfiguration-Contextheader are referencing different configurations.
- Using an
-
of
Equivalent toof(HttpServletRequest, HttpServletResponse)but without support to set theVaryheader.Callers must prefer to use the overload with the
responsewhen available so the clients do not cache the request.- Parameters:
request- the servlet request.- 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.contextquery parameter andConfiguration-Contextheader are referencing different configurations.- Since:
- 4.0.0
-