Class Route.FulfillOptions

  • Enclosing interface:
    Route

    public static class Route.FulfillOptions
    extends java.lang.Object
    • Field Detail

      • body

        public java.lang.String body
        Optional response body as text.
      • bodyBytes

        public byte[] bodyBytes
        Optional response body as raw bytes.
      • contentType

        public java.lang.String contentType
        If set, equals to setting Content-Type response header.
      • headers

        public java.util.Map<java.lang.String,​java.lang.String> headers
        Response headers. Header values will be converted to a string.
      • path

        public java.nio.file.Path path
        File path to respond with. The content type will be inferred from file extension. If path is a relative path, then it is resolved relative to the current working directory.
      • response

        public APIResponse response
        APIResponse to fulfill route's request with. Individual fields of the response (such as headers) can be overridden using fulfill options.
      • status

        public java.lang.Integer status
        Response status code, defaults to 200.
    • Constructor Detail

      • FulfillOptions

        public FulfillOptions()
    • Method Detail

      • setBody

        public Route.FulfillOptions setBody​(java.lang.String body)
        Optional response body as text.
      • setBodyBytes

        public Route.FulfillOptions setBodyBytes​(byte[] bodyBytes)
        Optional response body as raw bytes.
      • setContentType

        public Route.FulfillOptions setContentType​(java.lang.String contentType)
        If set, equals to setting Content-Type response header.
      • setHeaders

        public Route.FulfillOptions setHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
        Response headers. Header values will be converted to a string.
      • setPath

        public Route.FulfillOptions setPath​(java.nio.file.Path path)
        File path to respond with. The content type will be inferred from file extension. If path is a relative path, then it is resolved relative to the current working directory.
      • setResponse

        public Route.FulfillOptions setResponse​(APIResponse response)
        APIResponse to fulfill route's request with. Individual fields of the response (such as headers) can be overridden using fulfill options.
      • setStatus

        public Route.FulfillOptions setStatus​(int status)
        Response status code, defaults to 200.