|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.util.WebUtils org.codehaus.groovy.grails.web.util.WebUtils
public class WebUtils extends WebUtils
Utility methods to access commons objects and perform common web related functions for the internal framework.
Field Summary | |
---|---|
static java.lang.String |
DISPATCH_ACTION_PARAMETER
|
static java.lang.String |
ENABLE_FILE_EXTENSIONS
|
static char |
SLASH
|
Method Summary | |
---|---|
static boolean
|
areFileExtensionsEnabled()
Returns the value of the "grails.mime.file.extensions" setting configured in COnfig.groovy |
static java.lang.String
|
buildDispatchUrlForMapping(UrlMappingInfo info)
Constructs the URI to forward to using the given request and UrlMappingInfo instance |
static void
|
clearGrailsWebRequest()
Removes any GrailsWebRequest instance from the current request. |
static java.lang.String
|
forwardRequestForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info)
@see org.codehaus.groovy.grails.web.util.WebUtils#forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.codehaus.groovy.grails.web.mapping.UrlMappingInfo, java.util.Map) |
static java.lang.String
|
forwardRequestForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info, java.util.Map model)
@see #forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.codehaus.groovy.grails.web.mapping.UrlMappingInfo, java.util.Map, boolean) |
static java.lang.String
|
forwardRequestForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info, java.util.Map model, boolean includeParams)
Forwards a request for the given UrlMappingInfo object and model |
static java.lang.String
|
getFormatFromURI(java.lang.String uri)
Obtains the format from the URI. |
static java.lang.String
|
getForwardURI(HttpServletRequest request)
Obtains the forwardURI from the request, since Grails uses a forwarding technique for URL mappings. |
static java.lang.String
|
getRequestURIForGrailsDispatchURI(HttpServletRequest request)
The Grails dispatch servlet maps URIs like /app/grails/example/index.dispatch. |
static IncludedContent
|
includeForUrl(java.lang.String includeUrl, HttpServletRequest request, HttpServletResponse response, java.util.Map model)
Includes the given URL returning the resulting content as a String |
static IncludedContent
|
includeForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info, java.util.Map model)
Include whatever the given UrlMappingInfo maps to within the current response |
static GrailsApplication
|
lookupApplication(ServletContext servletContext)
Looks up the GrailsApplication instance |
static HandlerInterceptor[]
|
lookupHandlerInterceptors(ServletContext servletContext)
Looks up all of the HandlerInterceptor instances registered for the application |
static UrlMappingsHolder
|
lookupUrlMappings(ServletContext servletContext)
Looks up the UrlMappingsHolder instance |
static ViewResolver
|
lookupViewResolver(ServletContext servletContext)
|
static WebRequestInterceptor[]
|
lookupWebRequestInterceptors(ServletContext servletContext)
Looks up all of the WebRequestInterceptor instances registered with the application |
static View
|
resolveView(HttpServletRequest request, UrlMappingInfo info, java.lang.String viewName, ViewResolver viewResolver)
Resolves a view for the given view and UrlMappingInfo instance |
static View
|
resolveView(HttpServletRequest request, java.lang.String viewName, java.lang.String controllerName, ViewResolver viewResolver)
Resolves a view for the given view name and controller name |
static GrailsWebRequest
|
retrieveGrailsWebRequest()
Returns the GrailsWebRequest associated with the current request. |
static void
|
storeGrailsWebRequest(GrailsWebRequest webRequest)
Helper method to store the given GrailsWebRequest for the current request. |
static java.lang.String
|
toQueryString(java.util.Map params, java.lang.String encoding)
Converts the given params into a query string started with ? |
static java.lang.String
|
toQueryString(java.util.Map parameters)
Converts the given parameters to a query string using the default UTF-8 encoding |
Field Detail |
---|
public static final java.lang.String DISPATCH_ACTION_PARAMETER
public static final java.lang.String ENABLE_FILE_EXTENSIONS
public static final char SLASH
Method Detail |
---|
@SuppressWarnings("rawtypes") public static boolean areFileExtensionsEnabled()
public static java.lang.String buildDispatchUrlForMapping(UrlMappingInfo info)
info
- The UrlMappingInfo
public static void clearGrailsWebRequest()
public static java.lang.String forwardRequestForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info)
@SuppressWarnings("rawtypes") public static java.lang.String forwardRequestForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info, java.util.Map model)
@SuppressWarnings({ "unchecked", "rawtypes" }) public static java.lang.String forwardRequestForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info, java.util.Map model, boolean includeParams)
request
- The requestresponse
- The responseinfo
- The UrlMappingInfo objectmodel
- The ModelincludeParams
- Whether to include any request parameters
public static java.lang.String getFormatFromURI(java.lang.String uri)
null
.
uri
- The URI
public static java.lang.String getForwardURI(HttpServletRequest request)
request
- The request
public static java.lang.String getRequestURIForGrailsDispatchURI(HttpServletRequest request)
request
- The request
@SuppressWarnings({ "unchecked", "rawtypes" }) public static IncludedContent includeForUrl(java.lang.String includeUrl, HttpServletRequest request, HttpServletResponse response, java.util.Map model)
includeUrl
- The URL to includerequest
- The requestresponse
- The responsemodel
- The model
@SuppressWarnings({ "unchecked", "rawtypes" }) public static IncludedContent includeForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info, java.util.Map model)
request
- The requestresponse
- The responseinfo
- The UrlMappingInfomodel
- The model
public static GrailsApplication lookupApplication(ServletContext servletContext)
public static HandlerInterceptor[] lookupHandlerInterceptors(ServletContext servletContext)
servletContext
- The ServletContext instance
public static UrlMappingsHolder lookupUrlMappings(ServletContext servletContext)
servletContext
- The ServletContext object
public static ViewResolver lookupViewResolver(ServletContext servletContext)
public static WebRequestInterceptor[] lookupWebRequestInterceptors(ServletContext servletContext)
servletContext
- The ServletContext instance
public static View resolveView(HttpServletRequest request, UrlMappingInfo info, java.lang.String viewName, ViewResolver viewResolver)
request
- The requestinfo
- The infoviewName
- The view nameviewResolver
- The view resolver
public static View resolveView(HttpServletRequest request, java.lang.String viewName, java.lang.String controllerName, ViewResolver viewResolver)
request
- The requestviewName
- The view namecontrollerName
- The controller nameviewResolver
- The resolver
public static GrailsWebRequest retrieveGrailsWebRequest()
public static void storeGrailsWebRequest(GrailsWebRequest webRequest)
@SuppressWarnings("rawtypes") public static java.lang.String toQueryString(java.util.Map params, java.lang.String encoding)
params
- The paramsencoding
- The encoding to use
@SuppressWarnings("rawtypes") public static java.lang.String toQueryString(java.util.Map parameters)
parameters
- The parameters
Groovy Documentation