Package ratpack.groovy.handling
Interface GroovyByContentSpec
-
- All Superinterfaces:
ByContentSpec
- All Known Implementing Classes:
DefaultGroovyByContentSpec
public interface GroovyByContentSpec extends ByContentSpec
A Groovy oriented content negotiation handler builder.- Since:
- 1.5
- See Also:
GroovyContext.byMethod(Closure),ByMethodSpec
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default GroovyByContentSpechtml(Closure<?> handler)Specifies that the given handler should be used if the client wants content of type "text/html".GroovyByContentSpechtml(java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of type "text/html".GroovyByContentSpechtml(Block block)Specifies that the given handler should be used if the client wants content of type "text/html".GroovyByContentSpechtml(Handler handler)Specifies that the given handler should be used if the client wants content of type "text/html".default GroovyByContentSpecjson(Closure<?> handler)Specifies that the given handler should be used if the client wants content of type "application/json".GroovyByContentSpecjson(java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of type "application/json".GroovyByContentSpecjson(Block block)Specifies that the given handler should be used if the client wants content of type "application/json".GroovyByContentSpecjson(Handler handler)Specifies that the given handler should be used if the client wants content of type "application/json".default GroovyByContentSpecnoMatch(Closure<?> handler)Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.GroovyByContentSpecnoMatch(java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.GroovyByContentSpecnoMatch(java.lang.String mimeType)Specifies that the handler for the specified content type should be used if the client's requested content type cannot be matched with any of the other handlers.GroovyByContentSpecnoMatch(Block block)Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.GroovyByContentSpecnoMatch(Handler handler)Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.default GroovyByContentSpecplainText(Closure<?> handler)Specifies that the given handler should be used if the client wants content of type "text/plain".GroovyByContentSpecplainText(java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of type "text/plain".GroovyByContentSpecplainText(Block block)Specifies that the given handler should be used if the client wants content of type "text/plain".GroovyByContentSpecplainText(Handler handler)Specifies that the given handler should be used if the client wants content of type "text/plain".default GroovyByContentSpectype(java.lang.CharSequence mimeType, Closure<?> handler)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(java.lang.CharSequence mimeType, java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(java.lang.CharSequence mimeType, Block block)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(java.lang.CharSequence mimeType, Handler handler)Specifies that the given handler should be used if the client wants content of the given MIME type.default GroovyByContentSpectype(java.lang.String mimeType, Closure<?> handler)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(java.lang.String mimeType, java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(java.lang.String mimeType, Block block)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(java.lang.String mimeType, Handler handler)Specifies that the given handler should be used if the client wants content of the given MIME type.default GroovyByContentSpecunspecified(Closure<?> handler)Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.GroovyByContentSpecunspecified(java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.GroovyByContentSpecunspecified(java.lang.String mimeType)Specifies that the handler for the specified content type should be used if the client did not provide a usable "Accept" header in the request.GroovyByContentSpecunspecified(Block block)Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.GroovyByContentSpecunspecified(Handler handler)Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.default GroovyByContentSpecxml(Closure<?> handler)Specifies that the given handler should be used if the client wants content of type "application/xml".GroovyByContentSpecxml(java.lang.Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of type "application/xml".GroovyByContentSpecxml(Block block)Specifies that the given handler should be used if the client wants content of type "application/xml".GroovyByContentSpecxml(Handler handler)Specifies that the given handler should be used if the client wants content of type "application/xml".
-
-
-
Method Detail
-
type
default GroovyByContentSpec type(java.lang.String mimeType, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Parameters:
mimeType- the MIME type to register forhandler- the handler to invoke if the content type matches- Returns:
- this
-
type
default GroovyByContentSpec type(java.lang.CharSequence mimeType, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Parameters:
mimeType- the MIME type to register forhandler- the handler to invoke if the content type matches- Returns:
- this
- Since:
- 1.6
-
plainText
default GroovyByContentSpec plainText(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client wants content of type "text/plain".- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
html
default GroovyByContentSpec html(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client wants content of type "text/html".- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
json
default GroovyByContentSpec json(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client wants content of type "application/json".- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
xml
default GroovyByContentSpec xml(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client wants content of type "application/xml".- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
noMatch
default GroovyByContentSpec noMatch(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
unspecified
default GroovyByContentSpec unspecified(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Parameters:
handler- the handler to invoke if if no usable "Accept" header is present in the request.- Returns:
- this
-
type
GroovyByContentSpec type(java.lang.String mimeType, Block block)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Specified by:
typein interfaceByContentSpec- Parameters:
mimeType- the MIME type to register forblock- the code to invoke if the content type matches- Returns:
- this
-
type
GroovyByContentSpec type(java.lang.CharSequence mimeType, Block block)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Specified by:
typein interfaceByContentSpec- Parameters:
mimeType- the MIME type to register forblock- the code to invoke if the content type matches- Returns:
- this
-
type
GroovyByContentSpec type(java.lang.String mimeType, Handler handler)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Specified by:
typein interfaceByContentSpec- Parameters:
mimeType- the MIME type to register forhandler- the handler to invoke if the content type matches- Returns:
- this
-
type
GroovyByContentSpec type(java.lang.CharSequence mimeType, Handler handler)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Specified by:
typein interfaceByContentSpec- Parameters:
mimeType- the MIME type to register forhandler- the handler to invoke if the content type matches- Returns:
- this
-
type
GroovyByContentSpec type(java.lang.String mimeType, java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Specified by:
typein interfaceByContentSpec- Parameters:
mimeType- the MIME type to register forhandlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
type
GroovyByContentSpec type(java.lang.CharSequence mimeType, java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of the given MIME type. This only supports fully-specified content types (no "*" wildcards).- Specified by:
typein interfaceByContentSpec- Parameters:
mimeType- the MIME type to register forhandlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
plainText
GroovyByContentSpec plainText(Block block)
Specifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainTextin interfaceByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
plainText
GroovyByContentSpec plainText(Handler handler)
Specifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainTextin interfaceByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
plainText
GroovyByContentSpec plainText(java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainTextin interfaceByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
html
GroovyByContentSpec html(Block block)
Specifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
htmlin interfaceByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
html
GroovyByContentSpec html(Handler handler)
Specifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
htmlin interfaceByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
html
GroovyByContentSpec html(java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
htmlin interfaceByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
json
GroovyByContentSpec json(Block block)
Specifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
jsonin interfaceByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
json
GroovyByContentSpec json(Handler handler)
Specifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
jsonin interfaceByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
json
GroovyByContentSpec json(java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
jsonin interfaceByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
xml
GroovyByContentSpec xml(Block block)
Specifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xmlin interfaceByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
xml
GroovyByContentSpec xml(Handler handler)
Specifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xmlin interfaceByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
xml
GroovyByContentSpec xml(java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xmlin interfaceByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
noMatch
GroovyByContentSpec noMatch(Block block)
Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.- Specified by:
noMatchin interfaceByContentSpec- Parameters:
block- the code to invoke if the content type doesn't match- Returns:
- this
-
noMatch
GroovyByContentSpec noMatch(Handler handler)
Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.- Specified by:
noMatchin interfaceByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
noMatch
GroovyByContentSpec noMatch(java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.- Specified by:
noMatchin interfaceByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
noMatch
GroovyByContentSpec noMatch(java.lang.String mimeType)
Specifies that the handler for the specified content type should be used if the client's requested content type cannot be matched with any of the other handlers. Effectively, this treats the request as if the user requested the specified MIME type. If the specified mimeType doesn't have a registered block, it will result in a server error for applicable requests.- Specified by:
noMatchin interfaceByContentSpec- Parameters:
mimeType- the MIME type to use as a fallback if the requested type can't be matched- Returns:
- this
-
unspecified
GroovyByContentSpec unspecified(Block block)
Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecifiedin interfaceByContentSpec- Parameters:
block- the code to invoke if no usable "Accept" header is present in the request.- Returns:
- this
-
unspecified
GroovyByContentSpec unspecified(Handler handler)
Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecifiedin interfaceByContentSpec- Parameters:
handler- the handler to invoke if if no usable "Accept" header is present in the request.- Returns:
- this
-
unspecified
GroovyByContentSpec unspecified(java.lang.Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecifiedin interfaceByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use if no usable "Accept" header is present in the request.- Returns:
- this
-
unspecified
GroovyByContentSpec unspecified(java.lang.String mimeType)
Specifies that the handler for the specified content type should be used if the client did not provide a usable "Accept" header in the request. Effectively, this treats the request as if the user requested the specified MIME type. If the specified mimeType doesn't have a registered block, it will result in a server error for applicable requests.- Specified by:
unspecifiedin interfaceByContentSpec- Parameters:
mimeType- the MIME type to use as a fallback if no type is requested- Returns:
- this
-
-