Package ratpack.groovy.handling
Class DefaultGroovyByContentSpec
- java.lang.Object
-
- ratpack.groovy.handling.DefaultGroovyByContentSpec
-
- All Implemented Interfaces:
ByContentSpec,GroovyByContentSpec
public class DefaultGroovyByContentSpec extends Object implements GroovyByContentSpec
-
-
Constructor Summary
Constructors Constructor Description DefaultGroovyByContentSpec(ByContentSpec delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GroovyByContentSpechtml(Class<? extends Handler> handlerType)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".GroovyByContentSpechtml(Block block)Specifies that the given handler should be used if the client wants content of type "text/html".GroovyByContentSpecjson(Class<? extends Handler> handlerType)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".GroovyByContentSpecjson(Block block)Specifies that the given handler should be used if the client wants content of type "application/json".GroovyByContentSpecnoMatch(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(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(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.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.GroovyByContentSpecplainText(Class<? extends Handler> handlerType)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".GroovyByContentSpecplainText(Block block)Specifies that the given handler should be used if the client wants content of type "text/plain".GroovyByContentSpectype(CharSequence mimeType, Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(CharSequence mimeType, Handler handler)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(CharSequence mimeType, Block block)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(String mimeType, Class<? extends Handler> handlerType)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(String mimeType, Handler handler)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpectype(String mimeType, Block block)Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpecunspecified(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(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(Handler handler)Specifies that the given handler 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.GroovyByContentSpecxml(Class<? extends Handler> handlerType)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".GroovyByContentSpecxml(Block block)Specifies that the given handler should be used if the client wants content of type "application/xml".-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ratpack.groovy.handling.GroovyByContentSpec
html, json, noMatch, plainText, type, type, unspecified, xml
-
-
-
-
Constructor Detail
-
DefaultGroovyByContentSpec
public DefaultGroovyByContentSpec(ByContentSpec delegate)
-
-
Method Detail
-
type
public GroovyByContentSpec type(String mimeType, Block block)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
typein interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to register forblock- the code to invoke if the content type matches- Returns:
- this
-
type
public GroovyByContentSpec type(CharSequence mimeType, Block block)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
typein interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to register forblock- the code to invoke if the content type matches- Returns:
- this
-
type
public GroovyByContentSpec type(String mimeType, Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
typein interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to register forhandler- the handler to invoke if the content type matches- Returns:
- this
-
type
public GroovyByContentSpec type(CharSequence mimeType, Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
typein interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to register forhandler- the handler to invoke if the content type matches- Returns:
- this
-
type
public GroovyByContentSpec type(String mimeType, Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
typein interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to register forhandlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
type
public GroovyByContentSpec type(CharSequence mimeType, Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
typein interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to register forhandlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
plainText
public GroovyByContentSpec plainText(Block block)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainTextin interfaceByContentSpec- Specified by:
plainTextin interfaceGroovyByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
plainText
public GroovyByContentSpec plainText(Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainTextin interfaceByContentSpec- Specified by:
plainTextin interfaceGroovyByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
plainText
public GroovyByContentSpec plainText(Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainTextin interfaceByContentSpec- Specified by:
plainTextin interfaceGroovyByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
html
public GroovyByContentSpec html(Block block)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
htmlin interfaceByContentSpec- Specified by:
htmlin interfaceGroovyByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
html
public GroovyByContentSpec html(Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
htmlin interfaceByContentSpec- Specified by:
htmlin interfaceGroovyByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
html
public GroovyByContentSpec html(Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
htmlin interfaceByContentSpec- Specified by:
htmlin interfaceGroovyByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
json
public GroovyByContentSpec json(Block block)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
jsonin interfaceByContentSpec- Specified by:
jsonin interfaceGroovyByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
json
public GroovyByContentSpec json(Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
jsonin interfaceByContentSpec- Specified by:
jsonin interfaceGroovyByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
json
public GroovyByContentSpec json(Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
jsonin interfaceByContentSpec- Specified by:
jsonin interfaceGroovyByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
xml
public GroovyByContentSpec xml(Block block)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xmlin interfaceByContentSpec- Specified by:
xmlin interfaceGroovyByContentSpec- Parameters:
block- the code to invoke if the content type matches- Returns:
- this
-
xml
public GroovyByContentSpec xml(Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xmlin interfaceByContentSpec- Specified by:
xmlin interfaceGroovyByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
xml
public GroovyByContentSpec xml(Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xmlin interfaceByContentSpec- Specified by:
xmlin interfaceGroovyByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
noMatch
public GroovyByContentSpec noMatch(Block block)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
noMatchin interfaceGroovyByContentSpec- Parameters:
block- the code to invoke if the content type doesn't match- Returns:
- this
-
noMatch
public GroovyByContentSpec noMatch(Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
noMatchin interfaceGroovyByContentSpec- Parameters:
handler- the handler to invoke if the content type matches- Returns:
- this
-
noMatch
public GroovyByContentSpec noMatch(Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
noMatchin interfaceGroovyByContentSpec- Parameters:
handlerType- the type of handler to retrieve from the registry and use- Returns:
- this
-
noMatch
public GroovyByContentSpec noMatch(String mimeType)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
noMatchin interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to use as a fallback if the requested type can't be matched- Returns:
- this
-
unspecified
public GroovyByContentSpec unspecified(Block block)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecifiedin interfaceByContentSpec- Specified by:
unspecifiedin interfaceGroovyByContentSpec- Parameters:
block- the code to invoke if no usable "Accept" header is present in the request.- Returns:
- this
-
unspecified
public GroovyByContentSpec unspecified(Handler handler)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecifiedin interfaceByContentSpec- Specified by:
unspecifiedin interfaceGroovyByContentSpec- Parameters:
handler- the handler to invoke if if no usable "Accept" header is present in the request.- Returns:
- this
-
unspecified
public GroovyByContentSpec unspecified(Class<? extends Handler> handlerType)
Description copied from interface:GroovyByContentSpecSpecifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecifiedin interfaceByContentSpec- Specified by:
unspecifiedin interfaceGroovyByContentSpec- 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
public GroovyByContentSpec unspecified(String mimeType)
Description copied from interface:GroovyByContentSpecSpecifies 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- Specified by:
unspecifiedin interfaceGroovyByContentSpec- Parameters:
mimeType- the MIME type to use as a fallback if no type is requested- Returns:
- this
-
-