Trait actix_web::Route [] [src]

pub trait Route: Actor {
    type State;
    fn request(
        req: &mut HttpRequest,
        payload: Payload,
        ctx: &mut Self::Context
    ) -> RouteResult<Self>; fn expect(
        req: &HttpRequest,
        ctx: &mut Self::Context
    ) -> Result<(), HttpResponse>
    where
        Self: Actor<Context = HttpContext<Self>>
, { ... }
fn factory() -> RouteFactory<Self, Self::State> { ... } }

Actors with ability to handle http requests.

Associated Types

Shared state. State is shared with all routes within same application and could be accessed with HttpContext::state() method.

Required Methods

Handle incoming request. Route actor can return result immediately with Reply::reply. Actor itself can be returned with Reply::stream for handling streaming request/response or websocket connection. In that case HttpContext::start and HttpContext::write has to be used for writing response.

Provided Methods

Handle EXPECT header. By default respones with HTTP/1.1 100 Continue

This method creates RouteFactory for this actor.

Implementors