[−][src]Struct actix_web::HttpRequest
An HTTP Request
Methods
impl<S> HttpRequest<S>
[src]
impl<S> HttpRequest<S>
pub fn drop_state(&self) -> HttpRequest
[src]
pub fn drop_state(&self) -> HttpRequest
Construct new http request with empty state.
pub fn state(&self) -> &S
[src]
pub fn state(&self) -> &S
Shared application state
pub fn request(&self) -> &Request
[src]
pub fn request(&self) -> &Request
Server request
pub fn extensions(&self) -> Ref<Extensions>
[src]
pub fn extensions(&self) -> Ref<Extensions>
Request extensions
pub fn extensions_mut(&self) -> RefMut<Extensions>
[src]
pub fn extensions_mut(&self) -> RefMut<Extensions>
Mutable reference to a the request's extensions
pub fn response(&self, status: StatusCode, body: Body) -> HttpResponse
[src]
pub fn response(&self, status: StatusCode, body: Body) -> HttpResponse
Create http response
pub fn build_response(&self, status: StatusCode) -> HttpResponseBuilder
[src]
pub fn build_response(&self, status: StatusCode) -> HttpResponseBuilder
Create http response builder
pub fn uri(&self) -> &Uri
[src]
pub fn uri(&self) -> &Uri
Read the Request Uri.
pub fn method(&self) -> &Method
[src]
pub fn method(&self) -> &Method
Read the Request method.
pub fn version(&self) -> Version
[src]
pub fn version(&self) -> Version
Read the Request Version.
pub fn path(&self) -> &str
[src]
pub fn path(&self) -> &str
The target path of this Request.
pub fn connection_info(&self) -> Ref<ConnectionInfo>
[src]
pub fn connection_info(&self) -> Ref<ConnectionInfo>
Get ConnectionInfo for the correct request.
pub fn url_for<U, I>(
&self,
name: &str,
elements: U
) -> Result<Url, UrlGenerationError> where
U: IntoIterator<Item = I>,
I: AsRef<str>,
[src]
pub fn url_for<U, I>(
&self,
name: &str,
elements: U
) -> Result<Url, UrlGenerationError> where
U: IntoIterator<Item = I>,
I: AsRef<str>,
Generate url for named resource
fn index(req: HttpRequest) -> HttpResponse { let url = req.url_for("foo", &["1", "2", "3"]); // <- generate url for "foo" resource HttpResponse::Ok().into() } fn main() { let app = App::new() .resource("/test/{one}/{two}/{three}", |r| { r.name("foo"); // <- set resource name, then it could be used in `url_for` r.method(http::Method::GET).f(|_| HttpResponse::Ok()); }) .finish(); }
pub fn url_for_static(&self, name: &str) -> Result<Url, UrlGenerationError>
[src]
pub fn url_for_static(&self, name: &str) -> Result<Url, UrlGenerationError>
Generate url for named resource
This method is similar to HttpRequest::url_for()
but it can be used
for urls that do not contain variable parts.
pub fn resource(&self) -> &ResourceInfo
[src]
pub fn resource(&self) -> &ResourceInfo
This method returns reference to current RouteInfo
object.
pub fn peer_addr(&self) -> Option<SocketAddr>
[src]
pub fn peer_addr(&self) -> Option<SocketAddr>
Peer socket address
Peer address is actual socket address, if proxy is used in front of actix http server, then peer address would be address of this proxy.
To get client connection information connection_info()
method should
be used.
pub fn query(&self) -> Ref<HashMap<String, String>>
[src]
pub fn query(&self) -> Ref<HashMap<String, String>>
url query parameters.
pub fn query_string(&self) -> &str
[src]
pub fn query_string(&self) -> &str
The query string in the URL.
E.g., id=10
Load request cookies.
Return request cookie.
pub fn match_info(&self) -> &Params
[src]
pub fn match_info(&self) -> &Params
Get a reference to the Params object.
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 set_read_buffer_capacity(&mut self, cap: usize)
[src]
pub fn set_read_buffer_capacity(&mut self, cap: usize)
Set read buffer capacity
Default buffer capacity is 32Kb.
Methods from Deref<Target = Request>
pub fn uri(&self) -> &Uri
[src]
pub fn uri(&self) -> &Uri
Read the Request Uri.
pub fn method(&self) -> &Method
[src]
pub fn method(&self) -> &Method
Read the Request method.
pub fn version(&self) -> Version
[src]
pub fn version(&self) -> Version
Read the Request Version.
pub fn path(&self) -> &str
[src]
pub fn path(&self) -> &str
The target path of this Request.
pub fn headers(&self) -> &HeaderMap
[src]
pub fn headers(&self) -> &HeaderMap
Returns Request's headers.
pub fn peer_addr(&self) -> Option<SocketAddr>
[src]
pub fn peer_addr(&self) -> Option<SocketAddr>
Peer socket address
Peer address is actual socket address, if proxy is used in front of actix http server, then peer address would be address of this proxy.
To get client connection information connection_info()
method should
be used.
pub fn keep_alive(&self) -> bool
[src]
pub fn keep_alive(&self) -> bool
Checks if a connection should be kept alive.
pub fn extensions(&self) -> Ref<Extensions>
[src]
pub fn extensions(&self) -> Ref<Extensions>
Request extensions
pub fn extensions_mut(&self) -> RefMut<Extensions>
[src]
pub fn extensions_mut(&self) -> RefMut<Extensions>
Mutable reference to a the request's extensions
pub fn upgrade(&self) -> bool
[src]
pub fn upgrade(&self) -> bool
Check if request requires connection upgrade
pub fn connection_info(&self) -> Ref<ConnectionInfo>
[src]
pub fn connection_info(&self) -> Ref<ConnectionInfo>
Get ConnectionInfo for the correct request.
pub fn stream_extensions(&self) -> Option<&Extensions>
[src]
pub fn stream_extensions(&self) -> Option<&Extensions>
Io stream extensions
pub fn server_settings(&self) -> &ServerSettings
[src]
pub fn server_settings(&self) -> &ServerSettings
Server settings
Trait Implementations
impl<S> FromRequest<S> for HttpRequest<S>
[src]
impl<S> FromRequest<S> for HttpRequest<S>
type Config = ()
Configuration for conversion process
type Result = Self
Future that resolves to a Self
fn from_request(req: &HttpRequest<S>, _: &Self::Config) -> Self::Result
[src]
fn from_request(req: &HttpRequest<S>, _: &Self::Config) -> Self::Result
Convert request to a Self
fn extract(req: &HttpRequest<S>) -> Self::Result
[src]
fn extract(req: &HttpRequest<S>) -> Self::Result
Convert request to a Self Read more
impl<S> HttpMessage for HttpRequest<S>
[src]
impl<S> HttpMessage for HttpRequest<S>
type Stream = Payload
Type of message payload stream
fn headers(&self) -> &HeaderMap
[src]
fn headers(&self) -> &HeaderMap
Read the message headers.
fn payload(&self) -> Payload
[src]
fn payload(&self) -> Payload
Message payload stream
fn content_type(&self) -> &str
[src]
fn content_type(&self) -> &str
Read the request content type. If request does not contain Content-Type header, empty str get returned. Read more
fn encoding(&self) -> Result<EncodingRef, ContentTypeError>
[src]
fn encoding(&self) -> Result<EncodingRef, ContentTypeError>
Get content type encoding Read more
fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
[src]
fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
Convert the request content type to a known mime type.
fn chunked(&self) -> Result<bool, ParseError>
[src]
fn chunked(&self) -> Result<bool, ParseError>
Check if request has chunked transfer encoding
fn body(&self) -> MessageBody<Self>
[src]
fn body(&self) -> MessageBody<Self>
Load http message body. Read more
fn urlencoded<T: DeserializeOwned>(&self) -> UrlEncoded<Self, T>
[src]
fn urlencoded<T: DeserializeOwned>(&self) -> UrlEncoded<Self, T>
Parse application/x-www-form-urlencoded
encoded request's body. Return UrlEncoded
future. Form can be deserialized to any type that implements Deserialize
trait from serde. Read more
fn json<T: DeserializeOwned>(&self) -> JsonBody<Self, T>
[src]
fn json<T: DeserializeOwned>(&self) -> JsonBody<Self, T>
Parse application/json
encoded body. Return JsonBody<T>
future. It resolves to a T
value. Read more
fn multipart(&self) -> Multipart<Self::Stream>
[src]
fn multipart(&self) -> Multipart<Self::Stream>
Return stream to http payload processes as multipart. Read more
fn readlines(&self) -> Readlines<Self>
[src]
fn readlines(&self) -> Readlines<Self>
Return stream of lines.
impl<S> RequestIdentity for HttpRequest<S>
[src]
impl<S> RequestIdentity for HttpRequest<S>
fn identity(&self) -> Option<String>
[src]
fn identity(&self) -> Option<String>
Return the claimed identity of the user associated request or None
if no identity can be found associated with the request. Read more
fn remember(&self, identity: String)
[src]
fn remember(&self, identity: String)
Remember identity.
fn forget(&self)
[src]
fn forget(&self)
This method is used to 'forget' the current identity on subsequent requests. Read more
impl<S> RequestSession for HttpRequest<S>
[src]
impl<S> RequestSession for HttpRequest<S>
impl<'a, S> From<&'a HttpRequest<S>> for HttpResponseBuilder
[src]
impl<'a, S> From<&'a HttpRequest<S>> for HttpResponseBuilder
fn from(req: &'a HttpRequest<S>) -> HttpResponseBuilder
[src]
fn from(req: &'a HttpRequest<S>) -> HttpResponseBuilder
Performs the conversion.
impl<'a, S: 'static> From<&'a HttpRequest<S>> for ClientRequestBuilder
[src]
impl<'a, S: 'static> From<&'a HttpRequest<S>> for ClientRequestBuilder
Create ClientRequestBuilder
from HttpRequest
It is useful for proxy requests. This implementation copies all request headers and the method.
fn from(req: &'a HttpRequest<S>) -> ClientRequestBuilder
[src]
fn from(req: &'a HttpRequest<S>) -> ClientRequestBuilder
Performs the conversion.
impl<S> Clone for HttpRequest<S>
[src]
impl<S> Clone for HttpRequest<S>
fn clone(&self) -> HttpRequest<S>
[src]
fn clone(&self) -> HttpRequest<S>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<S> Drop for HttpRequest<S>
[src]
impl<S> Drop for HttpRequest<S>
impl<S> Debug for HttpRequest<S>
[src]
impl<S> Debug for HttpRequest<S>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<S> Deref for HttpRequest<S>
[src]
impl<S> Deref for HttpRequest<S>
Auto Trait Implementations
impl<S = ()> !Send for HttpRequest<S>
impl<S = ()> !Send for HttpRequest<S>
impl<S = ()> !Sync for HttpRequest<S>
impl<S = ()> !Sync for HttpRequest<S>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Erased for T
impl<T> Erased for T