接口 ServerResponse.BodyBuilder

    • 方法详细资料

      • body

        ServerResponse body​(Object body)
        Set the body of the response to the given Object and return it.

        Asynchronous response bodies are supported by providing a CompletionStage or Publisher as body.

        参数:
        body - the body of the response
        返回:
        the built response
      • body

        <T> ServerResponse body​(T body,
                                ParameterizedTypeReference<T> bodyType)
        Set the body of the response to the given Object and return it. The parameter bodyType is used to capture the generic type.
        参数:
        body - the body of the response
        bodyType - the type of the body, used to capture the generic type
        返回:
        the built response
      • render

        ServerResponse render​(String name,
                              Object... modelAttributes)
        Render the template with the given name using the given modelAttributes. The model attributes are mapped under a generated name.

        Note: Empty Collections are not added to the model when using this method because we cannot correctly determine the true convention name.

        参数:
        name - the name of the template to be rendered
        modelAttributes - the modelAttributes used to render the template
        返回:
        the built response
      • render

        ServerResponse render​(String name,
                              Map<String,​?> model)
        Render the template with the given name using the given model.
        参数:
        name - the name of the template to be rendered
        model - the model used to render the template
        返回:
        the built response