Interface GroovyByContentSpec

    • Method Detail

      • type

        default GroovyByContentSpec type​(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 for
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • type

        default GroovyByContentSpec type​(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 for
        handler - the handler to invoke if the content type matches
        Returns:
        this
        Since:
        1.6
      • 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​(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:
        type in interface ByContentSpec
        Parameters:
        mimeType - the MIME type to register for
        block - the code to invoke if the content type matches
        Returns:
        this
      • 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. This only supports fully-specified content types (no "*" wildcards).
        Specified by:
        type in interface ByContentSpec
        Parameters:
        mimeType - the MIME type to register for
        block - the code to invoke if the content type matches
        Returns:
        this
      • 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. This only supports fully-specified content types (no "*" wildcards).
        Specified by:
        type in interface ByContentSpec
        Parameters:
        mimeType - the MIME type to register for
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • 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. This only supports fully-specified content types (no "*" wildcards).
        Specified by:
        type in interface ByContentSpec
        Parameters:
        mimeType - the MIME type to register for
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • 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. This only supports fully-specified content types (no "*" wildcards).
        Specified by:
        type in interface ByContentSpec
        Parameters:
        mimeType - the MIME type to register for
        handlerType - the type of handler to retrieve from the registry and use
        Returns:
        this
      • type

        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. This only supports fully-specified content types (no "*" wildcards).
        Specified by:
        type in interface ByContentSpec
        Parameters:
        mimeType - the MIME type to register for
        handlerType - 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:
        plainText in interface ByContentSpec
        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:
        plainText in interface ByContentSpec
        Parameters:
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • plainText

        GroovyByContentSpec plainText​(Class<? extends Handler> handlerType)
        Specifies that the given handler should be used if the client wants content of type "text/plain".
        Specified by:
        plainText in interface ByContentSpec
        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:
        html in interface ByContentSpec
        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:
        html in interface ByContentSpec
        Parameters:
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • html

        GroovyByContentSpec html​(Class<? extends Handler> handlerType)
        Specifies that the given handler should be used if the client wants content of type "text/html".
        Specified by:
        html in interface ByContentSpec
        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:
        json in interface ByContentSpec
        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:
        json in interface ByContentSpec
        Parameters:
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • json

        GroovyByContentSpec json​(Class<? extends Handler> handlerType)
        Specifies that the given handler should be used if the client wants content of type "application/json".
        Specified by:
        json in interface ByContentSpec
        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:
        xml in interface ByContentSpec
        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:
        xml in interface ByContentSpec
        Parameters:
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • xml

        GroovyByContentSpec xml​(Class<? extends Handler> handlerType)
        Specifies that the given handler should be used if the client wants content of type "application/xml".
        Specified by:
        xml in interface ByContentSpec
        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:
        noMatch in interface ByContentSpec
        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:
        noMatch in interface ByContentSpec
        Parameters:
        handler - the handler to invoke if the content type matches
        Returns:
        this
      • noMatch

        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.
        Specified by:
        noMatch in interface ByContentSpec
        Parameters:
        handlerType - the type of handler to retrieve from the registry and use
        Returns:
        this
      • noMatch

        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. 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 interface ByContentSpec
        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:
        unspecified in interface ByContentSpec
        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:
        unspecified in interface ByContentSpec
        Parameters:
        handler - the handler to invoke if if no usable "Accept" header is present in the request.
        Returns:
        this
      • unspecified

        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.
        Specified by:
        unspecified in interface ByContentSpec
        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​(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:
        unspecified in interface ByContentSpec
        Parameters:
        mimeType - the MIME type to use as a fallback if no type is requested
        Returns:
        this