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

## [Groovy] Class ControllersMimeTypesApi

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

- Api extensions to controllers for the MimeTypes plugin.

  Authors:
    Graeme Rocher
  Since:
    2.0

- - ### Field Summary

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

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `java.lang.Object` | `withFormat(java.lang.Object instance, groovy.lang.Closure callable)`

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

- - ### Field Detail

    - #### protected MimeTypesApiSupport apiSupport

  - ### Method Detail

    - #### java.lang.Object withFormat(java.lang.Object instance, groovy.lang.Closure callable)

      The withFormat method is used to allow controllers to handle different types of request formats such as HTML, XML and so on. Example usage:

              withFormat {
                  html { render "html" }
                  xml { render "xml}
              }

      Parameters:
        instance
        callable
      Returns:
        The result of the closure execution selected