Package akka.http.scaladsl.model
Class HttpRequest
java.lang.Object
akka.http.javadsl.model.HttpRequest
akka.http.scaladsl.model.HttpRequest
- All Implemented Interfaces:
HttpMessage
,HttpMessage.MessageTransformations<HttpRequest>
,HttpMessage
The immutable model HTTP request model.
-
Nested Class Summary
Nested classes/interfaces inherited from interface akka.http.javadsl.model.HttpMessage
HttpMessage.DiscardedEntity, HttpMessage.MessageTransformations<Self>
Nested classes/interfaces inherited from interface akka.http.scaladsl.model.HttpMessage
HttpMessage.DiscardedEntity, HttpMessage.HttpMessageScalaDSLSugar, HttpMessage.HttpMessageScalaDSLSugar$
-
Constructor Summary
ConstructorsConstructorDescriptionHttpRequest
(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) Deprecated.use the constructor that includes an attributes parameter instead.HttpRequest
(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>, Object> attributes, RequestEntity entity, HttpProtocol protocol) -
Method Summary
Modifier and TypeMethodDescription_1()
_2()
scala.collection.immutable.Seq<HttpHeader>
_3()
_4()
_5()
static HttpRequest
apply
(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) scala.collection.immutable.Map<AttributeKey<?>,
Object> boolean
Determines whether this request can be safely retried, which is the case only of the request method is idempotent.scala.collection.immutable.Seq<HttpCookiePair>
cookies()
All cookies provided by the client in one or moreCookie
headers.copy
(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) Deprecated.Use the `withXYZ` methods instead.effectiveUri
(boolean securedConnection, Host defaultHostHeader) Resolve this request's URI according to the logic defined at http://tools.ietf.org/html/rfc7230#section-5.5entity()
Returns the entity of this request.boolean
getUri()
Java APIint
hashCode()
scala.collection.immutable.Seq<HttpHeader>
headers()
boolean
Is this instance a request.boolean
Is this instance a response.mapEntity
(scala.Function1<RequestEntity, RequestEntity> f) method()
Returns the Http method of this request.protocol()
The protocol of this message.self()
toString()
<M> HttpRequest
transformEntityDataBytes
(akka.stream.Graph<akka.stream.FlowShape<akka.util.ByteString, akka.util.ByteString>, M> transformer) Returns a copy of Self message after applying the given transformationstatic OptHttpRequest
unapply
(HttpRequest any) uri()
static void
Verifies that the givenUri
is non-empty and has either schemehttp
,https
,ws
,wss
or no scheme at all.withAttributes
(scala.collection.immutable.Map<AttributeKey<?>, Object> attributes) Returns a copy of this message with the attributes set to the given ones.withEffectiveUri
(boolean securedConnection, Host defaultHostHeader) Returns a copy of this request with the URI resolved according to the logic defined at http://tools.ietf.org/html/rfc7230#section-5.5withEntity
(RequestEntity entity) Returns a copy of this instance with a new entity.withEntity
(RequestEntity entity) Returns a copy of this message with the entity set to the given one.withHeaders
(scala.collection.immutable.Seq<HttpHeader> headers) Returns a copy of this message with the list of headers set to the given ones.withHeadersAndEntity
(scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity) Returns a copy of this message with the entity and headers set to the given ones.withMethod
(HttpMethod method) Returns a copy of this instance with a new method.withProtocol
(HttpProtocol protocol) Returns a copy of this message with a new protocol.Java APIReturns a copy of this instance with a new Uri.Methods inherited from class akka.http.javadsl.model.HttpRequest
create, create, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface akka.http.scaladsl.model.HttpMessage
addAttribute, addCredentials, addHeader, addHeaders, attribute, connectionCloseExpected, discardEntityBytes, discardEntityBytes, encoding, getAttribute, getHeader, getHeader, getHeaders, getHeaders, header, headers, mapAttributes, mapHeaders, removeAttribute, removeHeader, toStrict, toStrict, toStrict, toStrict, toStrict, toStrict, withDefaultHeaders, withDefaultHeaders, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withHeaders, withHeaders
Methods inherited from interface akka.http.javadsl.model.HttpMessage.MessageTransformations
addAttribute, addCredentials, addHeader, addHeaders, removeAttribute, removeHeader, toStrict, toStrict, toStrict, toStrict, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withHeaders
-
Constructor Details
-
HttpRequest
public HttpRequest(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>, Object> attributes, RequestEntity entity, HttpProtocol protocol) -
HttpRequest
public HttpRequest(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) Deprecated.use the constructor that includes an attributes parameter instead. Since 10.2.0.
-
-
Method Details
-
verifyUri
Verifies that the givenUri
is non-empty and has either schemehttp
,https
,ws
,wss
or no scheme at all. If any of these conditions is not met the method throws anIllegalUriException
.- Parameters:
uri
- (undocumented)
-
apply
public static HttpRequest apply(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) -
unapply
-
method
Description copied from class:HttpRequest
Returns the Http method of this request.- Specified by:
method
in classHttpRequest
-
uri
-
headers
- Specified by:
headers
in interfaceHttpMessage
-
attributes
- Specified by:
attributes
in interfaceHttpMessage
-
entity
Description copied from class:HttpRequest
Returns the entity of this request.- Specified by:
entity
in interfaceHttpMessage
- Specified by:
entity
in interfaceHttpMessage
- Specified by:
entity
in classHttpRequest
-
protocol
Description copied from interface:HttpMessage
The protocol of this message.- Specified by:
protocol
in interfaceHttpMessage
- Specified by:
protocol
in interfaceHttpMessage
-
self
- Specified by:
self
in interfaceHttpMessage
-
isRequest
public boolean isRequest()Description copied from interface:HttpMessage
Is this instance a request.- Specified by:
isRequest
in interfaceHttpMessage
- Specified by:
isRequest
in interfaceHttpMessage
-
isResponse
public boolean isResponse()Description copied from interface:HttpMessage
Is this instance a response.- Specified by:
isResponse
in interfaceHttpMessage
- Specified by:
isResponse
in interfaceHttpMessage
-
effectiveUri
Resolve this request's URI according to the logic defined at http://tools.ietf.org/html/rfc7230#section-5.5Throws an
IllegalUriException
if the URI is relative and theheaders
don't include a validHost
header or if URI authority andHost
header don't match.- Parameters:
securedConnection
- (undocumented)defaultHostHeader
- (undocumented)- Returns:
- (undocumented)
-
withEffectiveUri
Returns a copy of this request with the URI resolved according to the logic defined at http://tools.ietf.org/html/rfc7230#section-5.5- Parameters:
securedConnection
- (undocumented)defaultHostHeader
- (undocumented)- Returns:
- (undocumented)
-
cookies
All cookies provided by the client in one or moreCookie
headers.- Returns:
- (undocumented)
-
canBeRetried
public boolean canBeRetried()Determines whether this request can be safely retried, which is the case only of the request method is idempotent.- Returns:
- (undocumented)
-
withHeaders
Description copied from interface:HttpMessage
Returns a copy of this message with the list of headers set to the given ones.- Specified by:
withHeaders
in interfaceHttpMessage
-
withAttributes
public HttpRequest withAttributes(scala.collection.immutable.Map<AttributeKey<?>, Object> attributes) Description copied from interface:HttpMessage
Returns a copy of this message with the attributes set to the given ones.- Specified by:
withAttributes
in interfaceHttpMessage
-
withHeadersAndEntity
public HttpRequest withHeadersAndEntity(scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity) Description copied from interface:HttpMessage
Returns a copy of this message with the entity and headers set to the given ones.- Specified by:
withHeadersAndEntity
in interfaceHttpMessage
-
withEntity
Description copied from class:HttpRequest
Returns a copy of this instance with a new entity.- Specified by:
withEntity
in interfaceHttpMessage.MessageTransformations<HttpRequest>
- Specified by:
withEntity
in classHttpRequest
-
withEntity
Description copied from interface:HttpMessage
Returns a copy of this message with the entity set to the given one.- Specified by:
withEntity
in interfaceHttpMessage
-
mapEntity
-
withMethod
Description copied from class:HttpRequest
Returns a copy of this instance with a new method.- Specified by:
withMethod
in classHttpRequest
-
withProtocol
Description copied from interface:HttpMessage.MessageTransformations
Returns a copy of this message with a new protocol.- Specified by:
withProtocol
in interfaceHttpMessage.MessageTransformations<HttpRequest>
-
withUri
Description copied from class:HttpRequest
Returns a copy of this instance with a new Uri.- Specified by:
withUri
in classHttpRequest
-
withUri
-
transformEntityDataBytes
public <M> HttpRequest transformEntityDataBytes(akka.stream.Graph<akka.stream.FlowShape<akka.util.ByteString, akka.util.ByteString>, M> transformer) Description copied from interface:HttpMessage.MessageTransformations
Returns a copy of Self message after applying the given transformation- Specified by:
transformEntityDataBytes
in interfaceHttpMessage
- Specified by:
transformEntityDataBytes
in interfaceHttpMessage.MessageTransformations<HttpRequest>
-
getUri
Java API- Specified by:
getUri
in classHttpRequest
-
withUri
Java API- Specified by:
withUri
in classHttpRequest
-
copy
public HttpRequest copy(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) Deprecated.Use the `withXYZ` methods instead. Kept for binary compatibility. Since 10.2.0. -
hashCode
public int hashCode() -
equals
-
toString
-
_1
-
_2
-
_3
-
_4
-
_5
-