An abstraction that is responsible for decoding the request of general type.
An abstraction that is responsible for decoding the request of type A
.
A type alias for a org.jboss.netty.handler.codec.http.multipart.FileUpload to prevent imports.
An exception that indicates that a request item could be parsed.
An exception that indicates that a request item could be parsed.
the invalid request item
the type the item should be converted into
the cause of the parsing error
An exception that indicates a required request item (header, param, cookie, body) was missing in the request.
An exception that indicates a required request item (header, param, cookie, body) was missing in the request.
the missing request item
An exception that indicates a broken ValidationRule]] on the request item.
An exception that indicates a broken ValidationRule]] on the request item.
the invalid request item
the rule description
A polymorphic request reader (a reader monad) that reads a
com.twitter.util.Future of A
from the request of type R
.
A base exception of request reader.
An exception that collects multiple request reader errors.
An exception that collects multiple request reader errors.
the errors collected from various request readers
A PRequestReader with request type fixed to com.twitter.finagle.httpx.Request.
A reusable validation rule that can be applied to any RequestReader with a matching type.
(Since version 0.8.0) Custom request are deprecated
A type class that provides a conversion from some type to a com.twitter.finagle.httpx.Request.
A type class that provides a conversion from some type to a com.twitter.finagle.httpx.Request.
(Since version 0.8.0) Custom request are deprecated
A reasonable and safe approach to implicit view A => B
.
A reasonable and safe approach to implicit view A => B
.
(Since version 0.8.0) Custom request are deprecated
Convenience methods for creating new reader instances.
Allows the creation of reusable validation rules for RequestReaders.
A ValidationRule that makes sure the numeric value is greater than given n
.
A ValidationRule]] that makes sure the numeric value is less than given n
.
A ValidationRule]] that makes sure the string value is longer than n
symbols.
A ValidationRule]] that makes sure the string value is shorter than n
symbols.
A RequestReader that reads a required binary request body, interpreted as a Array[Byte]
, or throws a
NotPresent exception.
A RequestReader that reads a binary request body, interpreted as a Array[Byte]
, into an Option
.
A RequestReader that reads the required request body, interpreted as a String
, or throws a NotPresent
exception.
A RequestReader that reads an optional request body, interpreted as a String
, into an Option
.
Creates a RequestReader that reads a required cookie from the request or raises a NotPresent exception when the cookie is missing.
Creates a RequestReader that reads a required cookie from the request or raises a NotPresent exception when the cookie is missing.
the name of the cookie to read
the cookie
Creates a RequestReader that reads an optional HTTP cookie from the request into an Option
.
Creates a RequestReader that reads an optional HTTP cookie from the request into an Option
.
the name of the cookie to read
an Option
that contains a cookie or None if the cookie does not exist on the request.
Creates a RequestReader that reads a required file upload from a multipart/form-data request.
Creates a RequestReader that reads a required file upload from a multipart/form-data request.
the name of the parameter to read
the file
Creates a RequestReader that reads an optional file upload from a multipart/form-data request into an Option
.
Creates a RequestReader that reads an optional file upload from a multipart/form-data request into an Option
.
the name of the parameter to read
an Option
that contains the file or None
is the parameter does not exist on the request.
Creates a RequestReader that reads a required HTTP header name
from the request or raises a NotPresent
exception when the header is missing.
Creates a RequestReader that reads a required HTTP header name
from the request or raises a NotPresent
exception when the header is missing.
the header to read
a header
Creates a RequestReader that reads an optional HTTP header name
from the request into an Option
.
Creates a RequestReader that reads an optional HTTP header name
from the request into an Option
.
the header to read
an Option
that contains a header value or None
if the header is not present in the request
Representations for the various types that can be processed with RequestReaders.
Creates a RequestReader that reads a required query-string param name
from the request or raises a
NotPresent exception when the param is missing; a NotValid exception is the param is empty.
Creates a RequestReader that reads a required query-string param name
from the request or raises a
NotPresent exception when the param is missing; a NotValid exception is the param is empty.
the param name to read
a param value
Creates a RequestReader that reads an optional query-string param name
from the request into an Option
.
Creates a RequestReader that reads an optional query-string param name
from the request into an Option
.
the param to read
an Option
that contains a param value or None
if the param is empty
Creates a RequestReader that reads an optional (in a meaning that a resulting Seq
may be empty) multi-value
query-string param name
from the request into a Seq
.
Creates a RequestReader that reads an optional (in a meaning that a resulting Seq
may be empty) multi-value
query-string param name
from the request into a Seq
.
the param to read
a Seq
that contains all the values of multi-value param or an empty seq Nil
if the params are missing
or empty.
Creates a RequestReader that reads a required (in a meaning that a resulting Seq
will have at least one
element) multi-value query-string param name
from the request into a Seq
or raises a NotPresent exception
when the params are missing or empty.
Creates a RequestReader that reads a required (in a meaning that a resulting Seq
will have at least one
element) multi-value query-string param name
from the request into a Seq
or raises a NotPresent exception
when the params are missing or empty.
the param to read
a Seq
that contains all the values of multi-value param
Implicit conversion that allows the same inline rules to be used for required and optional values.
Implicit conversion that allows the same inline rules to be used for required and optional values. If the optional value is non-empty, it gets validated (and validation may fail, producing error), but if it is empty, it is always treated as valid.
In order to help the compiler determine the case when inline rule should be converted, the type of the validated value should be specified explicitly.
paramOption("foo").should("be greater than 50") { i: Int => i > 50 }
the underlying function to convert
This package introduces types and functions that enable _request processing_ in Finch. The io.finch.request primitives allow both to _read_ the various request items (query string param, header and cookie) using the RequestReader and _validate_ them using the ValidationRule.
The cornerstone abstraction of this package is a
RequestReader
, which is responsible for reading any amount of data from the HTTP request.RequestReader
s might be composed with each other using either monadic API (flatMap
method) or applicative API (::
method). Regardless the API used forRequestReader
s composition, the main idea behind it is to use primitive readers (i.e.,param
,paramOption
) in order to _compose_ them together and _map_ to the application domain data.A
ValidationRule
enables a reusable way of defining a validation rules in the application domain. It might be composed withRequestReader
s using eithershould
orshouldNot
methods and with otherValidationRule
s using logical methodsand
andor
.