Package kos.core

Interface Response

    • Field Detail

      • CREATED

        static final Response CREATED
      • ACCEPTED

        static final Response ACCEPTED
      • NO_CONTENT

        static final Response NO_CONTENT
      • BAD_REQUEST

        static final Response BAD_REQUEST
      • UNAUTHORIZED

        static final Response UNAUTHORIZED
      • FORBIDDEN

        static final Response FORBIDDEN
      • NOT_FOUND

        static final Response NOT_FOUND
      • METHOD_NOT_ALLOWED

        static final Response METHOD_NOT_ALLOWED
      • NOT_ACCEPTABLE

        static final Response NOT_ACCEPTABLE
      • CONFLICT

        static final Response CONFLICT
      • TOO_MANY_REQUESTS

        static final Response TOO_MANY_REQUESTS
      • NOT_IMPLEMENTED

        static final Response NOT_IMPLEMENTED
      • BAD_GATEWAY

        static final Response BAD_GATEWAY
      • SERVICE_UNAVAILABLE

        static final Response SERVICE_UNAVAILABLE
      • GATEWAY_TIMEOUT

        static final Response GATEWAY_TIMEOUT
    • Method Detail

      • statusCode

        int statusCode()
      • statusCode

        Response statusCode​(int value)
      • send

        void send​(io.vertx.core.http.HttpServerResponse response)
      • empty

        static Response empty()
        Creates an empty response.
      • empty

        static Response empty​(int statusCode)
        Creates an empty response for a given statusCode.
      • wrap

        static Response wrap​(io.vertx.core.buffer.Buffer serialized)
        Wraps a Buffer into a response.
      • of

        static <T> Response of​(T payload)
        Wraps an object as a response.
      • ofNullable

        static <T> Response ofNullable​(T payload)
        Wraps a nullable object as a response.
      • send

        static void send​(io.vertx.ext.web.RoutingContext context,
                         Object payload)
        Sends a response to the client. Internally it serializes the payload object using a previously defined PayloadSerializationStrategy. This method though is a semantically-equivalent to send(HttpServerResponse), but with different syntax.
        Parameters:
        context -
        payload -
      • send

        static void send​(io.vertx.ext.web.RoutingContext context,
                         Response response)
        Sends a response to the client. It will ensure that the defined statusCode and headers are send to the client. It also uses send(HttpServerResponse) to perform the serialization, allowing developers to design custom and powerful serialization mechanisms.
      • sendError

        static void sendError​(io.vertx.ext.web.RoutingContext context,
                              Throwable cause)
        Serializes a Throwable and sends as a response to the client. Internally it will use the appropriate ExceptionHandler to handle the failure and generate the response object.
      • sendDefaultNoContent

        static void sendDefaultNoContent​(io.vertx.ext.web.RoutingContext context)
        Sends an empty response to the client.
        See Also:
        Kos.defaultStatusForEmptyResponses