Class Route.FulfillOptions

  • Enclosing interface:
    Route

    public static class Route.FulfillOptions
    extends Object
    • Field Detail

      • body

        public String body
        Optional response body as text.
      • bodyBytes

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

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

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

        public 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 Integer status
        Response status code, defaults to 200.
    • Constructor Detail

      • FulfillOptions

        public FulfillOptions()
    • Method Detail

      • setBodyBytes

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

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

        public Route.FulfillOptions setPath​(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.