Package akka.http.scaladsl.model
Class HttpResponse
- java.lang.Object
-
- akka.http.javadsl.model.HttpResponse
-
- akka.http.scaladsl.model.HttpResponse
-
- All Implemented Interfaces:
HttpMessage
,HttpMessage.MessageTransformations<HttpResponse>
,HttpMessage
public final class HttpResponse extends HttpResponse implements HttpMessage
The immutable HTTP response 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
Constructors Constructor Description HttpResponse(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)
Deprecated.use the constructor that includes an attributes parameter instead.HttpResponse(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object> attributes, ResponseEntity entity, HttpProtocol protocol)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StatusCode
_1()
scala.collection.immutable.Seq<HttpHeader>
_2()
ResponseEntity
_3()
HttpProtocol
_4()
static HttpResponse
apply(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)
scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object>
attributes()
HttpResponse
copy(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)
Deprecated.Use the `withXYZ` methods instead.ResponseEntity
entity()
Returns the entity of this response.boolean
equals(java.lang.Object obj)
int
hashCode()
scala.collection.immutable.Seq<HttpHeader>
headers()
boolean
isRequest()
Is this instance a request.boolean
isResponse()
Is this instance a response.HttpResponse
mapEntity(scala.Function1<ResponseEntity,ResponseEntity> f)
HttpProtocol
protocol()
The protocol of this message.HttpResponse
self()
StatusCode
status()
Returns the status-code of this response.java.lang.String
toString()
<T> HttpResponse
transformEntityDataBytes(akka.stream.Graph<akka.stream.FlowShape<akka.util.ByteString,akka.util.ByteString>,T> transformer)
Returns a copy of Self message after applying the given transformationstatic OptHttpResponse
unapply(HttpResponse any)
HttpResponse
withAttributes(scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object> attributes)
Returns a copy of this message with the attributes set to the given ones.HttpResponse
withEntity(RequestEntity entity)
Returns a copy of Self message with a new entity.HttpResponse
withEntity(ResponseEntity entity)
Returns a copy of this instance with a new entity.HttpResponse
withEntity(RequestEntity entity)
Returns a copy of this message with the entity set to the given one.HttpResponse
withHeaders(scala.collection.immutable.Seq<HttpHeader> headers)
Returns a copy of this message with the list of headers set to the given ones.HttpResponse
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.HttpResponse
withHeadersAndEntity(scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity)
HttpResponse
withProtocol(HttpProtocol protocol)
Returns a copy of this message with a new protocol.HttpResponse
withProtocol(HttpProtocol protocol)
HttpResponse
withStatus(int statusCode)
Returns a copy of this instance with a new status-code.HttpResponse
withStatus(StatusCode statusCode)
Returns a copy of this instance with a new status-code.-
Methods inherited from class akka.http.javadsl.model.HttpResponse
create, encoding
-
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, 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 Detail
-
HttpResponse
public HttpResponse(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object> attributes, ResponseEntity entity, HttpProtocol protocol)
-
HttpResponse
public HttpResponse(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)
Deprecated.use the constructor that includes an attributes parameter instead. Since 10.2.0.
-
-
Method Detail
-
apply
public static HttpResponse apply(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)
-
unapply
public static OptHttpResponse unapply(HttpResponse any)
-
status
public StatusCode status()
Description copied from class:HttpResponse
Returns the status-code of this response.- Specified by:
status
in classHttpResponse
-
headers
public scala.collection.immutable.Seq<HttpHeader> headers()
- Specified by:
headers
in interfaceHttpMessage
-
attributes
public scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object> attributes()
- Specified by:
attributes
in interfaceHttpMessage
-
entity
public ResponseEntity entity()
Description copied from class:HttpResponse
Returns the entity of this response.- Specified by:
entity
in interfaceHttpMessage
- Specified by:
entity
in interfaceHttpMessage
- Specified by:
entity
in classHttpResponse
-
protocol
public HttpProtocol protocol()
Description copied from interface:HttpMessage
The protocol of this message.- Specified by:
protocol
in interfaceHttpMessage
- Specified by:
protocol
in interfaceHttpMessage
-
self
public HttpResponse 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
-
withHeaders
public HttpResponse withHeaders(scala.collection.immutable.Seq<HttpHeader> headers)
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 HttpResponse withAttributes(scala.collection.immutable.Map<AttributeKey<?>,java.lang.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
-
withProtocol
public HttpResponse withProtocol(HttpProtocol protocol)
Description copied from interface:HttpMessage.MessageTransformations
Returns a copy of this message with a new protocol.- Specified by:
withProtocol
in interfaceHttpMessage.MessageTransformations<HttpResponse>
-
withProtocol
public HttpResponse withProtocol(HttpProtocol protocol)
-
withStatus
public HttpResponse withStatus(int statusCode)
Description copied from class:HttpResponse
Returns a copy of this instance with a new status-code.- Specified by:
withStatus
in classHttpResponse
-
withStatus
public HttpResponse withStatus(StatusCode statusCode)
Description copied from class:HttpResponse
Returns a copy of this instance with a new status-code.- Specified by:
withStatus
in classHttpResponse
-
withHeadersAndEntity
public HttpResponse 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
-
withHeadersAndEntity
public HttpResponse withHeadersAndEntity(scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity)
-
withEntity
public HttpResponse withEntity(ResponseEntity entity)
Description copied from class:HttpResponse
Returns a copy of this instance with a new entity.- Specified by:
withEntity
in classHttpResponse
-
withEntity
public HttpResponse withEntity(RequestEntity entity)
Description copied from interface:HttpMessage
Returns a copy of this message with the entity set to the given one.- Specified by:
withEntity
in interfaceHttpMessage
-
withEntity
public HttpResponse withEntity(RequestEntity entity)
Description copied from interface:HttpMessage.MessageTransformations
Returns a copy of Self message with a new entity.- Specified by:
withEntity
in interfaceHttpMessage.MessageTransformations<HttpResponse>
-
mapEntity
public HttpResponse mapEntity(scala.Function1<ResponseEntity,ResponseEntity> f)
-
transformEntityDataBytes
public <T> HttpResponse transformEntityDataBytes(akka.stream.Graph<akka.stream.FlowShape<akka.util.ByteString,akka.util.ByteString>,T> 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<HttpResponse>
-
copy
public HttpResponse copy(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)
Deprecated.Use the `withXYZ` methods instead. Since 10.2.0.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
_1
public StatusCode _1()
-
_2
public scala.collection.immutable.Seq<HttpHeader> _2()
-
_3
public ResponseEntity _3()
-
_4
public HttpProtocol _4()
-
-