Package kos.api

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​(KosContext kosContext,
                  io.vertx.core.http.HttpServerResponse response)
      • empty

        static Response empty()
        Creates an empty response (defaults to 204 HTTP Status).
      • 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 (defaults to 200 HTTP Status).
      • of

        static <T> Response of​(T payload)
        Wraps an object as a response (defaults to 200 HTTP Status).
      • ofNullable

        static <T> Response ofNullable​(T payload)
        Wraps a nullable object as a response. Null payloads results in 204 HTTP Status, resulting in 200 otherwise.
      • send

        static void send​(KosContext kosContext,
                         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. Although this method is a semantically-equivalent to send(KosContext,HttpServerResponse) it was designed to be called directly by the generated routes.
      • send

        static void send​(KosContext kosContext,
                         io.vertx.core.http.HttpServerResponse httpResponse,
                         Object payload)
        Sends a response to the client. Internally it serializes the payload object using a previously defined PayloadSerializationStrategy. Although this method is a semantically-equivalent to send(KosContext,HttpServerResponse) it was designed to be called directly by the generated routes.
      • send

        static void send​(KosContext kosContext,
                         io.vertx.ext.web.RoutingContext context,
                         Response response)
        Sends a response to the client. It will delegate to send(KosContext, HttpServerResponse) to perform the serialization, allowing developers to design custom and powerful serialization mechanisms.
      • sendError

        static void sendError​(KosContext kosContext,
                              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.
      • sendError

        static void sendError​(KosContext kosContext,
                              io.vertx.core.http.HttpServerRequest request,
                              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.