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 GroovyByContentSpec
html(Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "text/html".GroovyByContentSpec
html(Handler handler)
Specifies that the given handler should be used if the client wants content of type "text/html".GroovyByContentSpec
html(Block block)
Specifies that the given handler should be used if the client wants content of type "text/html".GroovyByContentSpec
json(Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "application/json".GroovyByContentSpec
json(Handler handler)
Specifies that the given handler should be used if the client wants content of type "application/json".GroovyByContentSpec
json(Block block)
Specifies that the given handler should be used if the client wants content of type "application/json".GroovyByContentSpec
noMatch(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.GroovyByContentSpec
noMatch(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.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.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.GroovyByContentSpec
plainText(Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "text/plain".GroovyByContentSpec
plainText(Handler handler)
Specifies that the given handler should be used if the client wants content of type "text/plain".GroovyByContentSpec
plainText(Block block)
Specifies that the given handler should be used if the client wants content of type "text/plain".GroovyByContentSpec
type(CharSequence mimeType, Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpec
type(CharSequence mimeType, Handler handler)
Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpec
type(CharSequence mimeType, Block block)
Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpec
type(String mimeType, Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpec
type(String mimeType, Handler handler)
Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpec
type(String mimeType, Block block)
Specifies that the given handler should be used if the client wants content of the given MIME type.GroovyByContentSpec
unspecified(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.GroovyByContentSpec
unspecified(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.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.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.GroovyByContentSpec
xml(Class<? extends Handler> handlerType)
Specifies that the given handler should be used if the client wants content of type "application/xml".GroovyByContentSpec
xml(Handler handler)
Specifies that the given handler should be used if the client wants content of type "application/xml".GroovyByContentSpec
xml(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:GroovyByContentSpec
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:
type
in interfaceByContentSpec
- Specified by:
type
in 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:GroovyByContentSpec
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:
type
in interfaceByContentSpec
- Specified by:
type
in 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:GroovyByContentSpec
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:
type
in interfaceByContentSpec
- Specified by:
type
in 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:GroovyByContentSpec
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:
type
in interfaceByContentSpec
- Specified by:
type
in 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:GroovyByContentSpec
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:
type
in interfaceByContentSpec
- Specified by:
type
in 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:GroovyByContentSpec
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:
type
in interfaceByContentSpec
- Specified by:
type
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainText
in interfaceByContentSpec
- Specified by:
plainText
in interfaceGroovyByContentSpec
- Parameters:
block
- the code to invoke if the content type matches- Returns:
- this
-
plainText
public GroovyByContentSpec plainText(Handler handler)
Description copied from interface:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainText
in interfaceByContentSpec
- Specified by:
plainText
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "text/plain".- Specified by:
plainText
in interfaceByContentSpec
- Specified by:
plainText
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
html
in interfaceByContentSpec
- Specified by:
html
in interfaceGroovyByContentSpec
- Parameters:
block
- the code to invoke if the content type matches- Returns:
- this
-
html
public GroovyByContentSpec html(Handler handler)
Description copied from interface:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
html
in interfaceByContentSpec
- Specified by:
html
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "text/html".- Specified by:
html
in interfaceByContentSpec
- Specified by:
html
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
json
in interfaceByContentSpec
- Specified by:
json
in interfaceGroovyByContentSpec
- Parameters:
block
- the code to invoke if the content type matches- Returns:
- this
-
json
public GroovyByContentSpec json(Handler handler)
Description copied from interface:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
json
in interfaceByContentSpec
- Specified by:
json
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "application/json".- Specified by:
json
in interfaceByContentSpec
- Specified by:
json
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xml
in interfaceByContentSpec
- Specified by:
xml
in interfaceGroovyByContentSpec
- Parameters:
block
- the code to invoke if the content type matches- Returns:
- this
-
xml
public GroovyByContentSpec xml(Handler handler)
Description copied from interface:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xml
in interfaceByContentSpec
- Specified by:
xml
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client wants content of type "application/xml".- Specified by:
xml
in interfaceByContentSpec
- Specified by:
xml
in 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:GroovyByContentSpec
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:
noMatch
in interfaceByContentSpec
- Specified by:
noMatch
in 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:GroovyByContentSpec
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:
noMatch
in interfaceByContentSpec
- Specified by:
noMatch
in 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:GroovyByContentSpec
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:
noMatch
in interfaceByContentSpec
- Specified by:
noMatch
in 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:GroovyByContentSpec
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:
noMatch
in interfaceByContentSpec
- Specified by:
noMatch
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecified
in interfaceByContentSpec
- Specified by:
unspecified
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecified
in interfaceByContentSpec
- Specified by:
unspecified
in 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:GroovyByContentSpec
Specifies that the given handler should be used if the client did not provide a usable "Accept" header in the request.- Specified by:
unspecified
in interfaceByContentSpec
- Specified by:
unspecified
in 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:GroovyByContentSpec
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:
unspecified
in interfaceByContentSpec
- Specified by:
unspecified
in interfaceGroovyByContentSpec
- Parameters:
mimeType
- the MIME type to use as a fallback if no type is requested- Returns:
- this
-
-