Package: org.grails.web.mapping

## [Java] Class UrlMappingUtils

- org.grails.web.mapping.UrlMappingUtils

-     public class UrlMappingUtils
      extends java.lang.Object

  Utility methods for working with UrlMappings

  Authors:
    Graeme Rocher
  Since:
    2.4

- - ### Constructor Summary

    Constructors
    Constructor and description
    `private UrlMappingUtils ()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static java.lang.String` | `buildDispatchUrlForMapping(UrlMappingInfo info)` Constructs the URI to forward to using the given request and UrlMappingInfo instance
    `` | `private static java.lang.String` | `buildDispatchUrlForMapping(UrlMappingInfo info, boolean includeParams)`
    `` | `private static java.lang.String` | `buildDispatchUrlForMapping(UrlMappingInfo info, boolean includeParams, LinkGenerator linkGenerator)`
    `` | `public static java.util.Map` | `findAllParamsNotInKeys(java.util.Map params, java.util.Set keys)`
    `` | `public static java.util.Map` | `findAllParamsNotInUrlMappingKeywords(java.util.Map params)` Returns: a Map without entries whose key belongs to UrlMapping#KEYWORDS
    `` | `public static java.lang.String` | `forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info)` See Also: forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, grails.web.mapping.UrlMappingInfo, java.util.Map)
    `` | `public static java.lang.String` | `forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model)` See Also: forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, grails.web.mapping.UrlMappingInfo, java.util.Map, boolean)
    `` | `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)` Forwards a request for the given UrlMappingInfo object and model
    `` | `public static 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
    `` | `public static 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
    `` | `public static 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
    `` | `private static IncludedContent` | `includeForUrlMappingInfoHelper(java.lang.String includeUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model)`
    `` | `public static UrlMappingsHolder` | `lookupUrlMappings(javax.servlet.ServletContext servletContext)` Looks up the UrlMappingsHolder instance
    `` | `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)` Resolves a view for the given view and UrlMappingInfo instance

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### private UrlMappingUtils()

  - ### Method Detail

    - #### 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

    - #### @java.lang.SuppressWarnings("rawtypes") private static java.lang.String buildDispatchUrlForMapping(UrlMappingInfo info, boolean includeParams)

    - #### @java.lang.SuppressWarnings("rawtypes") private static java.lang.String buildDispatchUrlForMapping(UrlMappingInfo info, boolean includeParams, LinkGenerator linkGenerator)

    - #### public static java.util.Map findAllParamsNotInKeys(java.util.Map params, java.util.Set keys)

    - #### public static java.util.Map findAllParamsNotInUrlMappingKeywords(java.util.Map params)

      Returns:
        a Map without entries whose key belongs to UrlMapping#KEYWORDS

    - #### public static java.lang.String forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info)

      See Also:
        forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, grails.web.mapping.UrlMappingInfo, java.util.Map)

    - #### @java.lang.SuppressWarnings("rawtypes") public static java.lang.String forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model)

      See Also:
        forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, grails.web.mapping.UrlMappingInfo, java.util.Map, boolean)

    - #### @java.lang.SuppressWarnings({ "unchecked", "rawtypes" }) 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)

      Forwards a request for the given UrlMappingInfo object and model

      throws:
        javax.servlet.ServletException Thrown when an error occurs executing the forward
      throws:
        java.io.IOException Thrown when an error occurs executing the forward
      Parameters:
        `request` - The request
        `response` - The response
        `info` - The UrlMappingInfo object
        `model` - The Model
        `includeParams` - Whether to include any request parameters
      Returns:
        The URI forwarded too

    - #### @java.lang.SuppressWarnings({ "unchecked", "rawtypes" }) public static 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 include
        `request` - The request
        `response` - The response
        `model` - The model
      Returns:
        The content

    - #### @java.lang.SuppressWarnings({ "unchecked", "rawtypes" }) public static 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 request
        `response` - The response
        `info` - The UrlMappingInfo
        `model` - The model
      Returns:
        The included content

    - #### @java.lang.SuppressWarnings({ "unchecked", "rawtypes" }) public static 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 request
        `response` - The response
        `info` - The UrlMappingInfo
        `model` - The model
        `linkGenerator` - allows for reverse url mapping
      Returns:
        The included content

    - #### private static IncludedContent includeForUrlMappingInfoHelper(java.lang.String includeUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, UrlMappingInfo info, java.util.Map model)

    - #### public static UrlMappingsHolder lookupUrlMappings(javax.servlet.ServletContext servletContext)

      Looks up the UrlMappingsHolder instance

      Returns:
        The UrlMappingsHolder
      Parameters:
        `servletContext` - The ServletContext object

    - #### 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)

      Resolves a view for the given view and UrlMappingInfo instance

      throws:
        Exception
      Parameters:
        `request` - The request
        `info` - The info
        `viewName` - The view name
        `viewResolver` - The view resolver
      Returns:
        The view or null