public interface MvcContext
This class provides contextual information such as context and application
paths as well as access to the JAX-RS application configuration object.
In addition, it provides access to the security-related beans Csrf
and Encoders
.
Implementations of this class are injectable and accessible from EL using
the name mvc
. For example, the CSRF token name and value can be
accessed in EL using the expressions mvc.csrf.name
and mvc.csrf.token
, respectively.
Configuration
Modifier and Type | Method and Description |
---|---|
String |
getApplicationPath()
Get the application's path which was set using the
ApplicationPath
annotation. |
String |
getBasePath()
Get the application's base path which is defined as the concatenation of context
and application paths.
|
javax.ws.rs.core.Configuration |
getConfig()
Get the JAX-RS application configuration object.
|
String |
getContextPath()
Get the application's context path.
|
Csrf |
getCsrf()
Get the CSRF object.
|
Encoders |
getEncoders()
Get the built-in encoders.
|
javax.ws.rs.core.Configuration getConfig()
String getContextPath()
Get the application's context path. The value returned must be normalized
to start with a slash ('/'
) but not end with one. Thus, the path returned by
this method can be prepended to that returned by getApplicationPath()
.
For example, given the URI http://host:port/myapp/resources/hello
,
this method returns /myapp
.
ServletContext.getContextPath()
String getApplicationPath()
Get the application's path which was set using the ApplicationPath
annotation. The value returned must be normalized to start with a slash ('/'
) but
not end with one. Thus, the path returned by this method can be appended to that
returned by getContextPath()
.
If the application path is empty or was set to /*
, then an empty string is
returned to ensure concatenation with getContextPath()
results in a well-formed
path. If a JAX-RS application subclass is not found, null
may be returned.
For example, given the URI http://host:port/myapp/resources/hello
,
this method returns /resources
.
null
if not found.String getBasePath()
Get the application's base path which is defined as the concatenation of context and application paths. It follows that the value returned by this method always starts with a slash but never ends with one.
If a JAX-RS application subclass is not found, causing getApplicationPath()
to return null
, then the value returned is the same as getContextPath()
.
Csrf getCsrf()
Encoders getEncoders()
Copyright © 2015 Oracle Corporation. All rights reserved.