Struct ntex::web::HttpRequest [−][src]
pub struct HttpRequest(_);
Expand description
An HTTP Request
Implementations
impl HttpRequest
[src]
impl HttpRequest
[src]pub fn head(&self) -> &RequestHead
[src]
pub fn head(&self) -> &RequestHead
[src]This method returns reference to the request head
pub fn query_string(&self) -> &str
[src]
pub fn query_string(&self) -> &str
[src]The query string in the URL.
E.g., id=10
pub fn match_info(&self) -> &Path<Uri>
[src]
pub fn match_info(&self) -> &Path<Uri>
[src]Get 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 extensions(&self) -> Ref<'_, Extensions>
[src]
pub fn extensions(&self) -> Ref<'_, Extensions>
[src]Request extensions
pub fn extensions_mut(&self) -> RefMut<'_, Extensions>
[src]
pub fn extensions_mut(&self) -> RefMut<'_, Extensions>
[src]Mutable reference to a the request’s extensions
pub fn resource_map(&self) -> &ResourceMap
[src]
pub fn resource_map(&self) -> &ResourceMap
[src]Get a reference to a ResourceMap
of current application.
pub fn peer_addr(&self) -> Option<SocketAddr>
[src]
pub fn peer_addr(&self) -> Option<SocketAddr>
[src]Peer socket address
Peer address is actual socket address, if proxy is used in front of ntex http server, then peer address would be address of this proxy.
To get client connection information .connection_info()
should be used.
pub fn connection_info(&self) -> Ref<'_, ConnectionInfo>
[src]
pub fn connection_info(&self) -> Ref<'_, ConnectionInfo>
[src]Get ConnectionInfo for the current request.
This method panics if request’s extensions container is already borrowed.
pub fn app_config(&self) -> &AppConfig
[src]
pub fn app_config(&self) -> &AppConfig
[src]App config
Trait Implementations
impl Clone for HttpRequest
[src]
impl Clone for HttpRequest
[src]fn clone(&self) -> HttpRequest
[src]
fn clone(&self) -> HttpRequest
[src]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)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for HttpRequest
[src]
impl Debug for HttpRequest
[src]impl Drop for HttpRequest
[src]
impl Drop for HttpRequest
[src]impl<Err: ErrorRenderer> FromRequest<Err> for HttpRequest
[src]
impl<Err: ErrorRenderer> FromRequest<Err> for HttpRequest
[src]It is possible to get HttpRequest
as an extractor handler parameter
Example
use ntex::web::{self, App, HttpRequest}; /// extract `HttpRequest` from request async fn index(req: HttpRequest) -> String { format!("Got thing: {:?}", req) } fn main() { let app = App::new().service( web::resource("/users/{first}").route( web::get().to(index)) ); }
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
[src]
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
[src]Convert request to a Self
fn extract(req: &HttpRequest) -> Self::Future
[src]
fn extract(req: &HttpRequest) -> Self::Future
[src]Convert request to a Self Read more
impl HttpMessage for HttpRequest
[src]
impl HttpMessage for HttpRequest
[src]fn message_headers(&self) -> &HeaderMap
[src]
fn message_headers(&self) -> &HeaderMap
[src]Returns Request’s headers.
fn message_extensions(&self) -> Ref<'_, Extensions>
[src]
fn message_extensions(&self) -> Ref<'_, Extensions>
[src]Request extensions
fn message_extensions_mut(&self) -> RefMut<'_, Extensions>
[src]
fn message_extensions_mut(&self) -> RefMut<'_, Extensions>
[src]Mutable reference to a the request’s extensions
fn content_type(&self) -> &str
[src]
fn content_type(&self) -> &str
[src]Read the request content type. If request does not contain Content-Type header, empty str get returned. Read more
fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
[src]
fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
[src]Get content type encoding Read more
fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
[src]
fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
[src]Convert the request content type to a known mime type.
fn chunked(&self) -> Result<bool, ParseError>
[src]
fn chunked(&self) -> Result<bool, ParseError>
[src]Check if request has chunked transfer encoding
Auto Trait Implementations
impl !RefUnwindSafe for HttpRequest
impl !Send for HttpRequest
impl !Sync for HttpRequest
impl Unpin for HttpRequest
impl !UnwindSafe for HttpRequest
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more