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 SummaryNested classes/interfaces inherited from interface org.apache.pekko.http.javadsl.model.HttpMessageHttpMessage.DiscardedEntity, HttpMessage.MessageTransformations<Self>Nested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.model.HttpMessageHttpMessage.DiscardedEntity, HttpMessage.HttpMessageScalaDSLSugar, HttpMessage.HttpMessageScalaDSLSugar$
- 
Constructor SummaryConstructorsConstructorDescriptionHttpRequest(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>, Object> attributes, RequestEntity entity, HttpProtocol protocol) 
- 
Method SummaryModifier 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.HttpRequestcreate, create, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUTMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pekko.http.scaladsl.model.HttpMessageaddAttribute, 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.MessageTransformationsaddAttribute, addCredentials, addHeader, addHeaders, removeAttribute, removeHeader, toStrict, toStrict, toStrict, toStrict, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withHeaders
- 
Constructor Details- 
HttpRequestpublic HttpRequest(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>, Object> attributes, RequestEntity entity, HttpProtocol protocol) 
 
- 
- 
Method Details- 
verifyUriVerifies 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)
 
- 
applypublic static HttpRequest apply(HttpMethod method, Uri uri, scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity, HttpProtocol protocol) 
- 
unapply
- 
methodDescription copied from class:HttpRequestReturns the Http method of this request.- Specified by:
- methodin class- HttpRequest
 
- 
uri
- 
headers- Specified by:
- headersin interface- HttpMessage
 
- 
attributes- Specified by:
- attributesin interface- HttpMessage
 
- 
entityDescription copied from class:HttpRequestReturns the entity of this request.- Specified by:
- entityin interface- HttpMessage
- Specified by:
- entityin interface- HttpMessage
- Specified by:
- entityin class- HttpRequest
 
- 
protocolDescription copied from interface:HttpMessageThe protocol of this message.- Specified by:
- protocolin interface- HttpMessage
- Specified by:
- protocolin interface- HttpMessage
 
- 
self- Specified by:
- selfin interface- HttpMessage
 
- 
isRequestpublic boolean isRequest()Description copied from interface:HttpMessageIs this instance a request.- Specified by:
- isRequestin interface- HttpMessage
- Specified by:
- isRequestin interface- HttpMessage
 
- 
isResponsepublic boolean isResponse()Description copied from interface:HttpMessageIs this instance a response.- Specified by:
- isResponsein interface- HttpMessage
- Specified by:
- isResponsein interface- HttpMessage
 
- 
effectiveUriResolve 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)
 
- 
withEffectiveUriReturns 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)
 
- 
cookiesAll cookies provided by the client in one or moreCookieheaders.- Returns:
- (undocumented)
 
- 
canBeRetriedpublic boolean canBeRetried()Determines whether this request can be safely retried, which is the case only of the request method is idempotent.- Returns:
- (undocumented)
 
- 
withHeadersDescription copied from interface:HttpMessageReturns a copy of this message with the list of headers set to the given ones.- Specified by:
- withHeadersin interface- HttpMessage
 
- 
withAttributespublic 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 interface- HttpMessage
 
- 
withHeadersAndEntitypublic 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 interface- HttpMessage
 
- 
withEntityDescription copied from class:HttpRequestReturns a copy of this instance with a new entity.- Specified by:
- withEntityin interface- HttpMessage.MessageTransformations<HttpRequest>
- Specified by:
- withEntityin class- HttpRequest
 
- 
withEntityDescription copied from interface:HttpMessageReturns a copy of this message with the entity set to the given one.- Specified by:
- withEntityin interface- HttpMessage
 
- 
mapEntity
- 
withMethodDescription copied from class:HttpRequestReturns a copy of this instance with a new method.- Specified by:
- withMethodin class- HttpRequest
 
- 
withProtocolDescription copied from interface:HttpMessage.MessageTransformationsReturns a copy of this message with a new protocol.- Specified by:
- withProtocolin interface- HttpMessage.MessageTransformations<HttpRequest>
 
- 
withUriDescription copied from class:HttpRequestReturns a copy of this instance with a new Uri.- Specified by:
- withUriin class- HttpRequest
 
- 
withUri
- 
transformEntityDataBytespublic <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 interface- HttpMessage
- Specified by:
- transformEntityDataBytesin interface- HttpMessage.MessageTransformations<HttpRequest>
 
- 
getUriJava API- Specified by:
- getUriin class- HttpRequest
 
- 
withUriJava API- Specified by:
- withUriin class- HttpRequest
 
- 
hashCodepublic int hashCode()
- 
equals
- 
toString
- 
_1
- 
_2
- 
_3
- 
_4
- 
_5
 
-