[−][src]Trait fibers_http_server::HandleRequest
HandleRequest
allows for handling HTTP requests.
Associated Types
type ReqBody: Send + 'static
The type of the request bodies.
type ResBody: Send + 'static
The type of the response bodies.
type Decoder: BodyDecode<Item = Self::ReqBody> + Send + 'static
Request body decoder.
type Encoder: BodyEncode<Item = Self::ResBody> + Send + 'static
Response body encoder.
type Reply: Future<Item = Res<Self::ResBody>, Error = Never> + Send + 'static
Future
that represents reply to a request.
Associated Constants
const METHOD: &'static str
The method that the handler can handle.
const PATH: &'static str
The request path that the handler can handle.
*
and **
in the path have the special meanings as follows:
*
matches any path segment (i.e., regarded as a wildcard)**
matches all remaining parts of a path
Required methods
fn handle_request(&self, req: Req<Self::ReqBody>) -> Self::Reply
Handles a request.
Provided methods
fn handle_request_head(&self, req: &Req<()>) -> Option<Res<Self::ResBody>>
Handles the head part of a request.
If a Some(..)
value is returned, the invocation of handle_request
method will be skipped.
The default implementation always returns None
.
fn handle_decoding_error(
&self,
req: Req<()>,
error: &Error
) -> Option<Res<Self::ResBody>>
&self,
req: Req<()>,
error: &Error
) -> Option<Res<Self::ResBody>>
Handles an error occurred while decoding the body of a request.
The default implementation always returns None
(i.e., the default error response will be returned to the HTTP client).
Implementors
impl HandleRequest for MetricsHandler
[src]
const METHOD: &'static str
[src]
const PATH: &'static str
[src]
type ReqBody = ()
type ResBody = String
type Decoder = BodyDecoder<NullDecoder>
type Encoder = BodyEncoder<Utf8Encoder>
type Reply = Box<dyn Future<Item = Res<Self::ResBody>, Error = Never> + Send + 'static>
fn handle_request(&self, _req: Req<Self::ReqBody>) -> Self::Reply
[src]
fn handle_request_head(&self, req: &Req<()>) -> Option<Res<Self::ResBody>>
[src]
fn handle_decoding_error(
&self,
req: Req<()>,
error: &Error
) -> Option<Res<Self::ResBody>>
[src]
&self,
req: Req<()>,
error: &Error
) -> Option<Res<Self::ResBody>>
impl<H: HandleRequest> HandleRequest for WithMetrics<H>
[src]
const METHOD: &'static str
[src]
const PATH: &'static str
[src]
type ReqBody = H::ReqBody
type ResBody = H::ResBody
type Decoder = H::Decoder
type Encoder = H::Encoder
type Reply = Time<H>
fn handle_request(&self, req: Req<Self::ReqBody>) -> Self::Reply
[src]
fn handle_request_head(&self, req: &Req<()>) -> Option<Res<Self::ResBody>>
[src]
fn handle_decoding_error(
&self,
req: Req<()>,
error: &Error
) -> Option<Res<Self::ResBody>>
[src]
&self,
req: Req<()>,
error: &Error
) -> Option<Res<Self::ResBody>>