Groovy Documentation

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

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

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

Api extensions to controllers for the MimeTypes plugin.

Authors:
Graeme Rocher
Since:
2.0


Field Summary
protected MimeTypesApiSupport apiSupport

 
Method Summary
java.lang.Object withFormat(java.lang.Object instance, groovy.lang.Closure callable)

 
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

apiSupport

protected MimeTypesApiSupport apiSupport


 
Method Detail

withFormat

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


 

Groovy Documentation