Class HttpRequest
java.lang.Object
org.apache.pekko.http.javadsl.model.HttpRequest
org.apache.pekko.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 org.apache.pekko.http.javadsl.model.HttpMessage
HttpMessage.DiscardedEntity, HttpMessage.MessageTransformations<Self>Nested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.model.HttpMessage
HttpMessage.DiscardedEntity, HttpMessage.HttpMessageScalaDSLSugar, HttpMessage.HttpMessageScalaDSLSugar$ -
Constructor Summary
ConstructorsConstructorDescriptionHttpRequest(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 HttpRequestapply(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) scala.collection.immutable.Map<AttributeKey<?>,Object> booleanDetermines 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 moreCookieheaders.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.booleangetUri()Java APIinthashCode()scala.collection.immutable.Seq<HttpHeader>headers()booleanIs this instance a request.booleanIs 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> HttpRequesttransformEntityDataBytes(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<org.apache.pekko.util.ByteString, org.apache.pekko.util.ByteString>, M> transformer) Returns a copy of Self message after applying the given transformationstatic OptHttpRequestunapply(HttpRequest any) uri()static voidVerifies that the givenUriis non-empty and has either schemehttp,https,ws,wssor 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.Returns a copy of this instance with a new Uri.Java APIMethods inherited from class org.apache.pekko.http.javadsl.model.HttpRequest
create, create, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUTMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pekko.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, withHeadersMethods inherited from interface org.apache.pekko.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)
-
-
Method Details
-
verifyUri
Verifies that the givenUriis non-empty and has either schemehttp,https,ws,wssor 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:HttpRequestReturns the Http method of this request.- Specified by:
methodin classHttpRequest
-
uri
-
headers
- Specified by:
headersin interfaceHttpMessage
-
attributes
- Specified by:
attributesin interfaceHttpMessage
-
entity
Description copied from class:HttpRequestReturns the entity of this request.- Specified by:
entityin interfaceHttpMessage- Specified by:
entityin interfaceHttpMessage- Specified by:
entityin classHttpRequest
-
protocol
Description copied from interface:HttpMessageThe protocol of this message.- Specified by:
protocolin interfaceHttpMessage- Specified by:
protocolin interfaceHttpMessage
-
self
- Specified by:
selfin interfaceHttpMessage
-
isRequest
public boolean isRequest()Description copied from interface:HttpMessageIs this instance a request.- Specified by:
isRequestin interfaceHttpMessage- Specified by:
isRequestin interfaceHttpMessage
-
isResponse
public boolean isResponse()Description copied from interface:HttpMessageIs this instance a response.- Specified by:
isResponsein interfaceHttpMessage- Specified by:
isResponsein interfaceHttpMessage
-
effectiveUri
Resolve this request's URI according to the logic defined at http://tools.ietf.org/html/rfc7230#section-5.5Throws an
IllegalUriExceptionif the URI is relative and theheadersdon't include a validpekko.http.scaladsl.model.headers.Hostheader or if URI authority andpekko.http.scaladsl.model.headers.Hostheader 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 moreCookieheaders.- 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:HttpMessageReturns a copy of this message with the list of headers set to the given ones.- Specified by:
withHeadersin interfaceHttpMessage
-
withAttributes
public HttpRequest withAttributes(scala.collection.immutable.Map<AttributeKey<?>, Object> attributes) Description copied from interface:HttpMessageReturns a copy of this message with the attributes set to the given ones.- Specified by:
withAttributesin interfaceHttpMessage
-
withHeadersAndEntity
public HttpRequest withHeadersAndEntity(scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity) Description copied from interface:HttpMessageReturns a copy of this message with the entity and headers set to the given ones.- Specified by:
withHeadersAndEntityin interfaceHttpMessage
-
withEntity
Description copied from class:HttpRequestReturns a copy of this instance with a new entity.- Specified by:
withEntityin interfaceHttpMessage.MessageTransformations<HttpRequest>- Specified by:
withEntityin classHttpRequest
-
withEntity
Description copied from interface:HttpMessageReturns a copy of this message with the entity set to the given one.- Specified by:
withEntityin interfaceHttpMessage
-
mapEntity
-
withMethod
Description copied from class:HttpRequestReturns a copy of this instance with a new method.- Specified by:
withMethodin classHttpRequest
-
withProtocol
Description copied from interface:HttpMessage.MessageTransformationsReturns a copy of this message with a new protocol.- Specified by:
withProtocolin interfaceHttpMessage.MessageTransformations<HttpRequest>
-
withUri
Description copied from class:HttpRequestReturns a copy of this instance with a new Uri.- Specified by:
withUriin classHttpRequest
-
withUri
-
transformEntityDataBytes
public <M> HttpRequest transformEntityDataBytes(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<org.apache.pekko.util.ByteString, org.apache.pekko.util.ByteString>, M> transformer) Description copied from interface:HttpMessage.MessageTransformationsReturns a copy of Self message after applying the given transformation- Specified by:
transformEntityDataBytesin interfaceHttpMessage- Specified by:
transformEntityDataBytesin interfaceHttpMessage.MessageTransformations<HttpRequest>
-
getUri
Java API- Specified by:
getUriin classHttpRequest
-
withUri
Java API- Specified by:
withUriin classHttpRequest
-
hashCode
public int hashCode() -
equals
-
toString
-
_1
-
_2
-
_3
-
_4
-
_5
-