Struct jwt_actix::ServiceRequest [−]
pub struct ServiceRequest { /* fields omitted */ }
Expand description
A service level request wrapper.
Allows mutable access to request’s internal structures.
Implementations
impl ServiceRequest
impl ServiceRequest
Deconstruct request into parts
Get mutable access to inner HttpRequest
and Payload
pub fn from_parts(
req: HttpRequest,
payload: Payload<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>> + 'static, Global>>>
) -> ServiceRequest
pub fn from_parts(
req: HttpRequest,
payload: Payload<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>> + 'static, Global>>>
) -> ServiceRequest
Construct request from parts.
pub fn from_request(req: HttpRequest) -> ServiceRequest
pub fn from_request(req: HttpRequest) -> ServiceRequest
Construct request from request.
The returned ServiceRequest
would have no payload.
pub fn into_response<B, R>(self, res: R) -> ServiceResponse<B> where
R: Into<Response<B>>,
pub fn into_response<B, R>(self, res: R) -> ServiceResponse<B> where
R: Into<Response<B>>,
Create service response
pub fn error_response<E>(self, err: E) -> ServiceResponse<BoxBody> where
E: Into<Error>,
pub fn error_response<E>(self, err: E) -> ServiceResponse<BoxBody> where
E: Into<Error>,
Create service response for error
pub fn head(&self) -> &RequestHead
pub fn head(&self) -> &RequestHead
This method returns reference to the request head
pub fn head_mut(&mut self) -> &mut RequestHead
pub fn head_mut(&mut self) -> &mut RequestHead
This method returns reference to the request head
pub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
Returns request’s headers.
pub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Returns mutable request’s headers.
pub fn query_string(&self) -> &str
pub fn query_string(&self) -> &str
Counterpart to [HttpRequest::query_string
].
pub fn peer_addr(&self) -> Option<SocketAddr>
pub fn peer_addr(&self) -> Option<SocketAddr>
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.
pub fn connection_info(&self) -> Ref<'_, ConnectionInfo>
pub fn connection_info(&self) -> Ref<'_, ConnectionInfo>
Get ConnectionInfo for the current request.
pub fn match_info(&self) -> &Path<Url>
pub fn match_info(&self) -> &Path<Url>
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.
pub fn match_info_mut(&mut self) -> &mut Path<Url>
pub fn match_info_mut(&mut self) -> &mut Path<Url>
Returns a mutable reference to the Path parameters.
pub fn match_name(&self) -> Option<&str>
pub fn match_name(&self) -> Option<&str>
Counterpart to [HttpRequest::match_name
].
pub fn match_pattern(&self) -> Option<String>
pub fn match_pattern(&self) -> Option<String>
Counterpart to [HttpRequest::match_pattern
].
pub fn resource_map(&self) -> &ResourceMap
pub fn resource_map(&self) -> &ResourceMap
Get a reference to a ResourceMap
of current application.
pub fn app_config(&self) -> &AppConfig
pub fn app_config(&self) -> &AppConfig
Service configuration
Return request cookie.
pub fn set_payload(
&mut self,
payload: Payload<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>> + 'static, Global>>>
)
pub fn set_payload(
&mut self,
payload: Payload<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>> + 'static, Global>>>
)
Set request payload.
pub fn add_data_container(&mut self, extensions: Rc<Extensions>)
pub fn add_data_container(&mut self, extensions: Rc<Extensions>)
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.
Trait Implementations
impl Debug for ServiceRequest
impl Debug for ServiceRequest
impl HttpMessage for ServiceRequest
impl HttpMessage for ServiceRequest
Type of message payload stream
pub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
Read the message headers.
pub fn extensions(&self) -> Ref<'_, Extensions>
pub fn extensions(&self) -> Ref<'_, Extensions>
Returns a reference to the request-local data/extensions container.
pub fn extensions_mut(&self) -> RefMut<'_, Extensions>
pub fn extensions_mut(&self) -> RefMut<'_, Extensions>
Returns a mutable reference to the request-local data/extensions container.
pub fn take_payload(
&mut self
) -> Payload<<ServiceRequest as HttpMessage>::Stream>
pub fn take_payload(
&mut self
) -> Payload<<ServiceRequest as HttpMessage>::Stream>
Message payload stream
fn content_type(&self) -> &str
fn content_type(&self) -> &str
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.
impl Resource for ServiceRequest
impl Resource for ServiceRequest
type Path = Url
type Path = Url
Type of resource’s path returned in resource_path
.
pub fn resource_path(&mut self) -> &mut Path<<ServiceRequest as Resource>::Path>
impl<S, B> Service<ServiceRequest> for JwtAuthService<S> where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: MessageBody,
B: 'static,
[src]
impl<S, B> Service<ServiceRequest> for JwtAuthService<S> where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: MessageBody,
B: 'static,
[src]type Response = S::Response
type Response = S::Response
Responses given by the service.
type Error = S::Error
type Error = S::Error
Errors produced by the service when polling readiness or executing call.
The future response value.
Returns Ready
when the service is able to process requests. Read more
Process the request and return the response asynchronously. Read more
impl<S, B> Transform<S, ServiceRequest> for JwtAuth where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
B: 'static,
S::Future: 'static,
[src]
impl<S, B> Transform<S, ServiceRequest> for JwtAuth where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
B: 'static,
S::Future: 'static,
[src]type Response = S::Response
type Response = S::Response
Responses produced by the service.
type Error = S::Error
type Error = S::Error
Errors produced by the service.
type Transform = JwtAuthService<S>
type Transform = JwtAuthService<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