Package: org.codehaus.groovy.grails.plugins.web.api

## [Groovy] Class ServletRequestApi

- org.codehaus.groovy.grails.plugins.web.api.ServletRequestApi

- Additional methods added to the HttpServletRequest API.

  Authors:
    Graeme Rocher
  Since:
    2.0

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `groovy.lang.Closure` | `xhrRequestIdentifier`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `java.lang.Object` | `each(javax.servlet.http.HttpServletRequest instance, groovy.lang.Closure c)` enables iteration over request attributes with each method request.each { name, value -> }
    `java.lang.Object` | `find(javax.servlet.http.HttpServletRequest request, groovy.lang.Closure c)` enables searching of request attributes with request.find { it.key == 'foo' }
    `java.lang.Object` | `findAll(javax.servlet.http.HttpServletRequest request, groovy.lang.Closure c)` enables searching of for a number of request attributes using request.findAll { it.key.startsWith('foo') }
    `java.lang.String` | `getForwardURI(javax.servlet.http.HttpServletRequest instance)` @return retrieve the forwardURI for the request
    `boolean` | `isGet(javax.servlet.http.HttpServletRequest instance)` Return true if the request is a get
    `boolean` | `isPost(javax.servlet.http.HttpServletRequest instance)` Return true if the request is a post
    `boolean` | `isRedirected(javax.servlet.http.HttpServletRequest instance)` Whether the request has been redirected
    `boolean` | `isXhr(javax.servlet.http.HttpServletRequest instance)` @return test whether the current request is an XHR request

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), 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()`

- - ### Property Detail

    - #### groovy.lang.Closure xhrRequestIdentifier

  - ### Method Detail

    - #### java.lang.Object each(javax.servlet.http.HttpServletRequest instance, groovy.lang.Closure c)

      enables iteration over request attributes with each method request.each { name, value -> }

    - #### java.lang.Object find(javax.servlet.http.HttpServletRequest request, groovy.lang.Closure c)

      enables searching of request attributes with request.find { it.key == 'foo' }

    - #### java.lang.Object findAll(javax.servlet.http.HttpServletRequest request, groovy.lang.Closure c)

      enables searching of for a number of request attributes using request.findAll { it.key.startsWith('foo') }

    - #### java.lang.String getForwardURI(javax.servlet.http.HttpServletRequest instance)

      Returns:
        retrieve the forwardURI for the request

    - #### boolean isGet(javax.servlet.http.HttpServletRequest instance)

      Return true if the request is a get

    - #### boolean isPost(javax.servlet.http.HttpServletRequest instance)

      Return true if the request is a post

    - #### boolean isRedirected(javax.servlet.http.HttpServletRequest instance)

      Whether the request has been redirected

      Parameters:
        `instance` - The request instance
      Returns:
        true if the request has been redirect

    - #### boolean isXhr(javax.servlet.http.HttpServletRequest instance)

      Returns:
        test whether the current request is an XHR request