Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## org.codehaus.groovy.grails.plugins.web.api
[Groovy] Class RequestMimeTypesApi

    java.lang.Object
      org.codehaus.groovy.grails.plugins.web.api.RequestMimeTypesApi

    class RequestMimeTypesApi
    extends java.lang.Object

Methods added to the javax.servlet.http.HttpServletRequest instance for request format handling.

Authors:
  Graeme Rocher

Since:
  2.0

Property Summary
`MimeTypesApiSupport` | `apiSupport`
`GrailsApplication` | `grailsApplication`
`MimeType` | `mimeTypes`

Constructor Summary
`RequestMimeTypesApi()`
`RequestMimeTypesApi(GrailsApplication application, MimeType[] mimeTypes)`

Method Summary
`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.
`MimeType[]` | `getMimeTypes()`
`MimeType[]` | `getMimeTypes(javax.servlet.http.HttpServletRequest request)` Obtains a list of configured MimeType instances for the request
`java.lang.Object` | `withFormat(javax.servlet.http.HttpServletRequest request, groovy.lang.Closure callable)` Allows for the request.withFormat { } syntax

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

### apiSupport

    MimeTypesApiSupport apiSupport

### grailsApplication

    GrailsApplication grailsApplication

### mimeTypes

    MimeType mimeTypes

Constructor Detail

### RequestMimeTypesApi

    RequestMimeTypesApi()

### RequestMimeTypesApi

    RequestMimeTypesApi(GrailsApplication application, MimeType[] mimeTypes)

Method Detail

### getFormat

    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

### getMimeTypes

    MimeType[] getMimeTypes()

### getMimeTypes

    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

### withFormat

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

  Allows for the request.withFormat { } syntax
  Parameters:
    `request` - The request
    `callable` - A closure
  Returns:
    The result of the closure call

Groovy Documentation