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
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
ConstructorsConstructorDescriptionHttpResponse
(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<?>, Object> attributes, ResponseEntity entity, HttpProtocol protocol) -
Method Summary
Modifier and TypeMethodDescription_1()
scala.collection.immutable.Seq<HttpHeader>
_2()
_3()
_4()
static HttpResponse
apply
(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol) scala.collection.immutable.Map<AttributeKey<?>,
Object> copy
(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol) Deprecated.Use the `withXYZ` methods instead.entity()
Returns the entity of this response.boolean
int
hashCode()
scala.collection.immutable.Seq<HttpHeader>
headers()
boolean
Is this instance a request.boolean
Is this instance a response.mapEntity
(scala.Function1<ResponseEntity, ResponseEntity> f) protocol()
The protocol of this message.self()
status()
Returns the status-code of this response.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) withAttributes
(scala.collection.immutable.Map<AttributeKey<?>, Object> attributes) Returns a copy of this message with the attributes set to the given ones.withEntity
(RequestEntity entity) Returns a copy of Self message with a new entity.withEntity
(ResponseEntity 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.withHeadersAndEntity
(scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity) withProtocol
(HttpProtocol protocol) Returns a copy of this message with a new protocol.withProtocol
(HttpProtocol protocol) withStatus
(int statusCode) Returns a copy of this instance with a new status-code.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, 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
-
HttpResponse
public HttpResponse(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>, 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 Details
-
apply
public static HttpResponse apply(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol) -
unapply
-
status
Description copied from class:HttpResponse
Returns the status-code of this response.- Specified by:
status
in classHttpResponse
-
headers
- Specified by:
headers
in interfaceHttpMessage
-
attributes
- Specified by:
attributes
in interfaceHttpMessage
-
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
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
-
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 HttpResponse 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
-
withProtocol
Description copied from interface:HttpMessage.MessageTransformations
Returns a copy of this message with a new protocol.- Specified by:
withProtocol
in interfaceHttpMessage.MessageTransformations<HttpResponse>
-
withProtocol
-
withStatus
Description copied from class:HttpResponse
Returns a copy of this instance with a new status-code.- Specified by:
withStatus
in classHttpResponse
-
withStatus
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
Description copied from class:HttpResponse
Returns a copy of this instance with a new entity.- Specified by:
withEntity
in classHttpResponse
-
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
-
withEntity
Description copied from interface:HttpMessage.MessageTransformations
Returns a copy of Self message with a new entity.- Specified by:
withEntity
in interfaceHttpMessage.MessageTransformations<HttpResponse>
-
mapEntity
-
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
-
hashCode
public int hashCode() -
toString
-
_1
-
_2
-
_3
-
_4
-