Package: org.grails.web.mime

## [Groovy] Class HttpServletRequestExtension

- org.grails.web.mime.HttpServletRequestExtension

-     @groovy.transform.CompileStatic
      class HttpServletRequestExtension
      extends java.lang.Object

  An extension that adds methods to the javax.servlet.http.HttpServletRequest object for mime types

  Authors:
    Jeff Brown
    Graeme Rocher
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected static MimeTypesApiSupport` | `apiSupport` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `HttpServletRequestExtension ()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static java.lang.String` | `getFormat(javax.servlet.http.HttpServletRequest request)` Obtains the request format, which is dictated by the CONTENT_TYPE header and evaluated using the configured MimeType instances.
    `` | `static MimeType[]` | `getMimeTypes(javax.servlet.http.HttpServletRequest request)` Obtains a list of configured MimeType instances for the request
    `` | `static java.lang.Object` | `withFormat(javax.servlet.http.HttpServletRequest request, groovy.lang.Closure callable)`

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

- - ### Field Detail

    - #### protected static MimeTypesApiSupport apiSupport

  - ### Constructor Detail

    - #### HttpServletRequestExtension()

  - ### Method Detail

    - #### static java.lang.String getFormat(javax.servlet.http.HttpServletRequest request)

      Obtains the request format, which is dictated by the CONTENT_TYPE header and evaluated using the configured MimeType instances. Only configured MimeTypes are allowed.

      Parameters:
        `request` - The request object
      Returns:
        The request format or null if exists

    - #### static MimeType[] getMimeTypes(javax.servlet.http.HttpServletRequest request)

      Obtains a list of configured MimeType instances for the request

      Parameters:
        `request` - The request
      Returns:
        A list of configured mime types

    - #### static java.lang.Object withFormat(javax.servlet.http.HttpServletRequest request, groovy.lang.Closure callable)