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 HttpResponseapply(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object>attributes()HttpResponsecopy(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol)Deprecated.Use the `withXYZ` methods instead.ResponseEntityentity()Returns the entity of this response.booleanequals(java.lang.Object obj)inthashCode()scala.collection.immutable.Seq<HttpHeader>headers()booleanisRequest()Is this instance a request.booleanisResponse()Is this instance a response.HttpResponsemapEntity(scala.Function1<ResponseEntity,ResponseEntity> f)HttpProtocolprotocol()The protocol of this message.HttpResponseself()StatusCodestatus()Returns the status-code of this response.java.lang.StringtoString()<T> HttpResponsetransformEntityDataBytes(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 OptHttpResponseunapply(HttpResponse any)HttpResponsewithAttributes(scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object> attributes)Returns a copy of this message with the attributes set to the given ones.HttpResponsewithEntity(RequestEntity entity)Returns a copy of Self message with a new entity.HttpResponsewithEntity(ResponseEntity entity)Returns a copy of this instance with a new entity.HttpResponsewithEntity(RequestEntity entity)Returns a copy of this message with the entity set to the given one.HttpResponsewithHeaders(scala.collection.immutable.Seq<HttpHeader> headers)Returns a copy of this message with the list of headers set to the given ones.HttpResponsewithHeadersAndEntity(scala.collection.immutable.Seq<HttpHeader> headers, RequestEntity entity)Returns a copy of this message with the entity and headers set to the given ones.HttpResponsewithHeadersAndEntity(scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity)HttpResponsewithProtocol(HttpProtocol protocol)Returns a copy of this message with a new protocol.HttpResponsewithProtocol(HttpProtocol protocol)HttpResponsewithStatus(int statusCode)Returns a copy of this instance with a new status-code.HttpResponsewithStatus(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:HttpResponseReturns the status-code of this response.- Specified by:
statusin classHttpResponse
-
headers
public scala.collection.immutable.Seq<HttpHeader> headers()
- Specified by:
headersin interfaceHttpMessage
-
attributes
public scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object> attributes()
- Specified by:
attributesin interfaceHttpMessage
-
entity
public ResponseEntity entity()
Description copied from class:HttpResponseReturns the entity of this response.- Specified by:
entityin interfaceHttpMessage- Specified by:
entityin interfaceHttpMessage- Specified by:
entityin classHttpResponse
-
protocol
public HttpProtocol protocol()
Description copied from interface:HttpMessageThe protocol of this message.- Specified by:
protocolin interfaceHttpMessage- Specified by:
protocolin interfaceHttpMessage
-
self
public HttpResponse 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
-
withHeaders
public HttpResponse withHeaders(scala.collection.immutable.Seq<HttpHeader> headers)
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 HttpResponse withAttributes(scala.collection.immutable.Map<AttributeKey<?>,java.lang.Object> attributes)
Description copied from interface:HttpMessageReturns a copy of this message with the attributes set to the given ones.- Specified by:
withAttributesin interfaceHttpMessage
-
withProtocol
public HttpResponse withProtocol(HttpProtocol protocol)
Description copied from interface:HttpMessage.MessageTransformationsReturns a copy of this message with a new protocol.- Specified by:
withProtocolin interfaceHttpMessage.MessageTransformations<HttpResponse>
-
withProtocol
public HttpResponse withProtocol(HttpProtocol protocol)
-
withStatus
public HttpResponse withStatus(int statusCode)
Description copied from class:HttpResponseReturns a copy of this instance with a new status-code.- Specified by:
withStatusin classHttpResponse
-
withStatus
public HttpResponse withStatus(StatusCode statusCode)
Description copied from class:HttpResponseReturns a copy of this instance with a new status-code.- Specified by:
withStatusin classHttpResponse
-
withHeadersAndEntity
public HttpResponse 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
-
withHeadersAndEntity
public HttpResponse withHeadersAndEntity(scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity)
-
withEntity
public HttpResponse withEntity(ResponseEntity entity)
Description copied from class:HttpResponseReturns a copy of this instance with a new entity.- Specified by:
withEntityin classHttpResponse
-
withEntity
public HttpResponse withEntity(RequestEntity entity)
Description copied from interface:HttpMessageReturns a copy of this message with the entity set to the given one.- Specified by:
withEntityin interfaceHttpMessage
-
withEntity
public HttpResponse withEntity(RequestEntity entity)
Description copied from interface:HttpMessage.MessageTransformationsReturns a copy of Self message with a new entity.- Specified by:
withEntityin 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.MessageTransformationsReturns a copy of Self message after applying the given transformation- Specified by:
transformEntityDataBytesin interfaceHttpMessage- Specified by:
transformEntityDataBytesin 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
_1
public StatusCode _1()
-
_2
public scala.collection.immutable.Seq<HttpHeader> _2()
-
_3
public ResponseEntity _3()
-
_4
public HttpProtocol _4()
-
-