Package org.grails.web.mapping
Class UrlMappingUtils
- java.lang.Object
-
- org.grails.web.mapping.UrlMappingUtils
-
public class UrlMappingUtils extends java.lang.ObjectUtility methods for working with UrlMappings- Since:
- 2.4
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbuildDispatchUrlForMapping(UrlMappingInfo info)Constructs the URI to forward to using the given request and UrlMappingInfo instancestatic java.util.MapfindAllParamsNotInKeys(java.util.Map params, java.util.Set keys)static java.util.MapfindAllParamsNotInUrlMappingKeywords(java.util.Map params)static java.lang.StringforwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info)static java.lang.StringforwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model)static java.lang.StringforwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map<java.lang.String,java.lang.Object> model, boolean includeParams)Forwards a request for the given UrlMappingInfo object and modelstatic org.grails.web.util.IncludedContentincludeForUrl(java.lang.String includeUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.Map model)Includes the given URL returning the resulting content as a Stringstatic org.grails.web.util.IncludedContentincludeForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model)Include whatever the given UrlMappingInfo maps to within the current responsestatic org.grails.web.util.IncludedContentincludeForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model, LinkGenerator linkGenerator)Include whatever the given UrlMappingInfo maps to within the current responsestatic UrlMappingsHolderlookupUrlMappings(javax.servlet.ServletContext servletContext)Looks up the UrlMappingsHolder instancestatic org.springframework.web.servlet.ViewresolveView(javax.servlet.http.HttpServletRequest request, UrlMappingInfo info, java.lang.String viewName, org.springframework.web.servlet.ViewResolver viewResolver)Resolves a view for the given view and UrlMappingInfo instance
-
-
-
Method Detail
-
findAllParamsNotInUrlMappingKeywords
public static java.util.Map findAllParamsNotInUrlMappingKeywords(java.util.Map params)
- Returns:
- a Map without entries whose key belongs to UrlMapping#KEYWORDS
-
findAllParamsNotInKeys
public static java.util.Map findAllParamsNotInKeys(java.util.Map params, java.util.Set keys)
-
lookupUrlMappings
public static UrlMappingsHolder lookupUrlMappings(javax.servlet.ServletContext servletContext)
Looks up the UrlMappingsHolder instance- Parameters:
servletContext- The ServletContext object- Returns:
- The UrlMappingsHolder
-
resolveView
public static org.springframework.web.servlet.View resolveView(javax.servlet.http.HttpServletRequest request, UrlMappingInfo info, java.lang.String viewName, org.springframework.web.servlet.ViewResolver viewResolver) throws java.lang.ExceptionResolves a view for the given view and UrlMappingInfo instance- Parameters:
request- The requestinfo- The infoviewName- The view nameviewResolver- The view resolver- Returns:
- The view or null
- Throws:
java.lang.Exception
-
buildDispatchUrlForMapping
public static java.lang.String buildDispatchUrlForMapping(UrlMappingInfo info)
Constructs the URI to forward to using the given request and UrlMappingInfo instance- Parameters:
info- The UrlMappingInfo- Returns:
- The URI to forward to
-
forwardRequestForUrlMappingInfo
public static java.lang.String forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info) throws javax.servlet.ServletException, java.io.IOException- Throws:
javax.servlet.ServletExceptionjava.io.IOException- See Also:
forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, grails.web.mapping.UrlMappingInfo, java.util.Map)
-
forwardRequestForUrlMappingInfo
public static java.lang.String forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model) throws javax.servlet.ServletException, java.io.IOException- Throws:
javax.servlet.ServletExceptionjava.io.IOException- See Also:
forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, grails.web.mapping.UrlMappingInfo, java.util.Map, boolean)
-
forwardRequestForUrlMappingInfo
public static java.lang.String forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map<java.lang.String,java.lang.Object> model, boolean includeParams) throws javax.servlet.ServletException, java.io.IOExceptionForwards a request for the given UrlMappingInfo object and model- Parameters:
request- The requestresponse- The responseinfo- The UrlMappingInfo objectmodel- The ModelincludeParams- Whether to include any request parameters- Returns:
- The URI forwarded too
- Throws:
javax.servlet.ServletException- Thrown when an error occurs executing the forwardjava.io.IOException- Thrown when an error occurs executing the forward
-
includeForUrlMappingInfo
public static org.grails.web.util.IncludedContent includeForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model)Include whatever the given UrlMappingInfo maps to within the current response- Parameters:
request- The requestresponse- The responseinfo- The UrlMappingInfomodel- The model- Returns:
- The included content
-
includeForUrlMappingInfo
public static org.grails.web.util.IncludedContent includeForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model, LinkGenerator linkGenerator)Include whatever the given UrlMappingInfo maps to within the current response- Parameters:
request- The requestresponse- The responseinfo- The UrlMappingInfomodel- The modellinkGenerator- allows for reverse url mapping- Returns:
- The included content
-
includeForUrl
public static org.grails.web.util.IncludedContent includeForUrl(java.lang.String includeUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.Map model)Includes the given URL returning the resulting content as a String- Parameters:
includeUrl- The URL to includerequest- The requestresponse- The responsemodel- The model- Returns:
- The content
-
-