Struct actix_web::dev::ServiceRequest
source · [−]pub struct ServiceRequest { /* private fields */ }
Expand description
A service level request wrapper.
Allows mutable access to request’s internal structures.
Implementations
Deconstruct request into parts
Get mutable access to inner HttpRequest
and Payload
Construct request from parts.
Construct request from request.
The returned ServiceRequest
would have no payload.
Create service response
Create service response for error
This method returns reference to the request head
This method returns reference to the request head
Returns mutable request’s headers.
Counterpart to HttpRequest::query_string
.
Peer socket address.
Peer address is the directly connected peer’s socket address. If a proxy is used in front of the Actix Web server, then it would be address of this proxy.
To get client connection information ConnectionInfo
should be used.
Will only return None when called in unit tests.
Get ConnectionInfo for the current request.
Returns a reference to the Path parameters.
Params is a container for URL parameters.
A variable segment is specified in the form {identifier}
,
where the identifier can be used later in a request handler to
access the matched value for that segment.
Returns a mutable reference to the Path parameters.
Counterpart to HttpRequest::match_name
.
Counterpart to HttpRequest::match_pattern
.
Get a reference to a ResourceMap
of current application.
Service configuration
Counterpart to HttpRequest::app_data
.
Counterpart to HttpRequest::conn_data
.
Return request cookie.
Set request payload.
Add data container to request’s resolution set.
In middleware, prefer extensions_mut
for request-local
data since it is assumed that the same app data is presented for every request.
Creates a context object for use with a guard.
Useful if you are implementing
Trait Implementations
type Stream = BoxedPayloadStream
type Stream = BoxedPayloadStream
Type of message payload stream
Returns a reference to the request-local data/extensions container.
Returns a mutable reference to the request-local data/extensions container.
Message payload stream
Read the request content type. If request did not contain a Content-Type header, an empty string is returned. Read more
Get content type encoding Read more
Convert the request content type to a known mime type.
Check if request has chunked transfer encoding.
type Response = ServiceResponse
type Response = ServiceResponse
Responses given by the created services.
type Service = RouteService
type Service = RouteService
The kind of Service
created by this factory.
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>
The future of the Service
instance.g
Create and return a new service asynchronously.
impl<S, B> Transform<S, ServiceRequest> for DefaultHeaders where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
impl<S, B> Transform<S, ServiceRequest> for DefaultHeaders where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
type Response = ServiceResponse<B>
type Response = ServiceResponse<B>
Responses produced by the service.
type Transform = DefaultHeadersMiddleware<S>
type Transform = DefaultHeadersMiddleware<S>
The TransformService
value created by this factory
Creates and returns a new Transform component, asynchronously
impl<S, B> Transform<S, ServiceRequest> for ErrorHandlers<B> where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: 'static,
impl<S, B> Transform<S, ServiceRequest> for ErrorHandlers<B> where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: 'static,
type Response = ServiceResponse<EitherBody<B>>
type Response = ServiceResponse<EitherBody<B>>
Responses produced by the service.
type Transform = ErrorHandlersMiddleware<S, B>
type Transform = ErrorHandlersMiddleware<S, B>
The TransformService
value created by this factory
type Future = LocalBoxFuture<'static, Result<Self::Transform, Self::InitError>>
type Future = LocalBoxFuture<'static, Result<Self::Transform, Self::InitError>>
The future response value.
Creates and returns a new Transform component, asynchronously
impl<S, B> Transform<S, ServiceRequest> for Logger where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
impl<S, B> Transform<S, ServiceRequest> for Logger where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
type Response = ServiceResponse<StreamLog<B>>
type Response = ServiceResponse<StreamLog<B>>
Responses produced by the service.
type Transform = LoggerMiddleware<S>
type Transform = LoggerMiddleware<S>
The TransformService
value created by this factory
Creates and returns a new Transform component, asynchronously
impl<S, B> Transform<S, ServiceRequest> for NormalizePath where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
impl<S, B> Transform<S, ServiceRequest> for NormalizePath where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
type Response = ServiceResponse<B>
type Response = ServiceResponse<B>
Responses produced by the service.
type Transform = NormalizePathNormalization<S>
type Transform = NormalizePathNormalization<S>
The TransformService
value created by this factory
Creates and returns a new Transform component, asynchronously
impl<S, B> Transform<S, ServiceRequest> for Compress where
B: MessageBody,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
impl<S, B> Transform<S, ServiceRequest> for Compress where
B: MessageBody,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
type Response = ServiceResponse<EitherBody<Encoder<B>>>
type Response = ServiceResponse<EitherBody<Encoder<B>>>
Responses produced by the service.
type Transform = CompressMiddleware<S>
type Transform = CompressMiddleware<S>
The TransformService
value created by this factory
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations
impl !RefUnwindSafe for ServiceRequest
impl !Send for ServiceRequest
impl !Sync for ServiceRequest
impl Unpin for ServiceRequest
impl !UnwindSafe for ServiceRequest
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more