public interface ViewEngineContext
Contextual data used by a ViewEngine
to process a view.
This includes the view name, the models instance and the request and response
objects from the container, among other data.
ViewEngine
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Configuration |
getConfiguration()
Returns the application's configuration.
|
Locale |
getLocale()
Returns the request locale resolved for the current request.
|
javax.ws.rs.core.MediaType |
getMediaType()
The media type to use for the response.
|
Models |
getModels()
Returns the models instance needed to process the view.
|
OutputStream |
getOutputStream()
The output stream which should be used to write the result of processing a view.
|
<T> T |
getRequest(Class<T> type)
Returns the HTTP request object from the container.
|
javax.ws.rs.container.ResourceInfo |
getResourceInfo()
Returns the
ResourceInfo instance containing
information about the controller method matched in the current request. |
<T> T |
getResponse(Class<T> type)
Returns the HTTP response object from the container.
|
javax.ws.rs.core.MultivaluedMap<String,Object> |
getResponseHeaders()
Get the mutable response headers multivalued map.
|
javax.ws.rs.core.UriInfo |
getUriInfo()
Returns the
UriInfo instance containing information
about the current request URI. |
String |
getView()
Returns the view.
|
String getView()
Models getModels()
Locale getLocale()
<T> T getRequest(Class<T> type)
HttpServletRequest
object.T
- The expected type of the HTTP request objecttype
- The expected type of the HTTP request object.<T> T getResponse(Class<T> type)
Returns the HTTP response object from the container. The type of the response object
depends on the environment. In a servlet environment you can use this method to get
the HttpServletResponse
object.
Please note that you should generally prefer using getOutputStream()
and getResponseHeaders()
to write the result of processing the view, because
these methods are guaranteed to work in all supported environments.
T
- The expected type of the HTTP request objecttype
- The expected type of the HTTP response object.javax.ws.rs.core.MultivaluedMap<String,Object> getResponseHeaders()
getOutputStream()
.OutputStream getOutputStream()
javax.ws.rs.core.MediaType getMediaType()
ViewEngine
implementations should respect the charset parameter of the media type when
writing data to the output stream obtained from getOutputStream()
.javax.ws.rs.core.UriInfo getUriInfo()
UriInfo
instance containing information
about the current request URI.UriInfo
javax.ws.rs.container.ResourceInfo getResourceInfo()
ResourceInfo
instance containing
information about the controller method matched in the current request.ResourceInfo
javax.ws.rs.core.Configuration getConfiguration()
ViewEngine.VIEW_FOLDER
, which
view engines must use to locate views.Configuration
Copyright © 2018 Ivar Grimstad. All rights reserved.