ResponseMimeTypesApi (Grails 2.3.8)
Date: 2014-04-24

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 ResponseMimeTypesApi

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

    @groovy.transform.CompileStatic
    class ResponseMimeTypesApi
    extends java.lang.Object

Methods added to javax.servlet.http.HttpServletResponse for response format handling.

Authors:
  Graeme Rocher

Since:
  2.0

Field Summary
`protected java.util.regex.Pattern` | `disableForUserAgents`
`protected boolean` | `useAcceptHeader`

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

Constructor Summary
`ResponseMimeTypesApi()` Initialize with default settings
`ResponseMimeTypesApi(GrailsApplication application, MimeType[] types)` Initialize with settings provided by GrailsApplication and the given MimeType[]

Method Summary
`java.lang.String` | `getFormat(javax.servlet.http.HttpServletResponse response)` Obtains the format to use for the response using either the file extension or the ACCEPT header
`MimeType` | `getMimeType(javax.servlet.http.HttpServletResponse response)` Obtains the MimeType for the response using either the file extension or the ACCEPT header
`MimeType` | `getMimeTypeForRequest(GrailsWebRequest webRequest)`
`MimeType[]` | `getMimeTypes()`
`MimeType[]` | `getMimeTypes(javax.servlet.http.HttpServletResponse response)` Gets the configured mime types for the response
`MimeType[]` | `getMimeTypesFormatAware(javax.servlet.http.HttpServletResponse response)` Gets the configured mime types for the response
`protected void` | `loadConfig()`
`java.lang.Object` | `withFormat(javax.servlet.http.HttpServletResponse response, groovy.lang.Closure callable)` Allows for the response.withFormat { } syntax

Methods inherited from 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()

Field Detail

### disableForUserAgents

    protected java.util.regex.Pattern disableForUserAgents

### useAcceptHeader

    protected boolean useAcceptHeader

Property Detail

### apiSupport

    MimeTypesApiSupport apiSupport

### grailsApplication

    GrailsApplication grailsApplication

### mimeTypes

    MimeType[] mimeTypes

Constructor Detail

### ResponseMimeTypesApi

    ResponseMimeTypesApi()

  Initialize with default settings

### ResponseMimeTypesApi

    ResponseMimeTypesApi(GrailsApplication application, MimeType[] types)

  Initialize with settings provided by GrailsApplication and the given MimeType[]
  Parameters:
    `application` - The GrailsApplication
    `mimeTypes` - The mime types

Method Detail

### getFormat

    java.lang.String getFormat(javax.servlet.http.HttpServletResponse response)

  Obtains the format to use for the response using either the file extension or the ACCEPT header
  Parameters:
    `response` - The response
  Returns:
    The request format

### getMimeType

    MimeType getMimeType(javax.servlet.http.HttpServletResponse response)

  Obtains the MimeType for the response using either the file extension or the ACCEPT header
  Parameters:
    `response` - The response
  Returns:
    The MimeType

### getMimeTypeForRequest

    MimeType getMimeTypeForRequest(GrailsWebRequest webRequest)

### getMimeTypes

    MimeType[] getMimeTypes()

### getMimeTypes

    MimeType[] getMimeTypes(javax.servlet.http.HttpServletResponse response)

  Gets the configured mime types for the response
  Parameters:
    `response` - The response
  Returns:
    The configured mime types

### getMimeTypesFormatAware

    MimeType[] getMimeTypesFormatAware(javax.servlet.http.HttpServletResponse response)

  Gets the configured mime types for the response
  Parameters:
    `response` - The response
  Returns:
    The configured mime types

### loadConfig

    protected void loadConfig()

### withFormat

    java.lang.Object withFormat(javax.servlet.http.HttpServletResponse response, groovy.lang.Closure callable)

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

Groovy Documentation