Class HttpResponse
java.lang.Object
org.apache.pekko.http.javadsl.model.HttpResponse
org.apache.pekko.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 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
ConstructorsConstructorDescriptionHttpResponse(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 HttpResponseapply(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, ResponseEntity entity, HttpProtocol protocol) scala.collection.immutable.Map<AttributeKey<?>,Object> entity()Returns the entity of this response.booleaninthashCode()scala.collection.immutable.Seq<HttpHeader>headers()booleanIs this instance a request.booleanIs 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> HttpResponsetransformEntityDataBytes(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<org.apache.pekko.util.ByteString, org.apache.pekko.util.ByteString>, T> transformer) Returns a copy of Self message after applying the given transformationstatic OptHttpResponseunapply(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 org.apache.pekko.http.javadsl.model.HttpResponse
create, encodingMethods 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
-
HttpResponse
public HttpResponse(StatusCode status, scala.collection.immutable.Seq<HttpHeader> headers, scala.collection.immutable.Map<AttributeKey<?>, Object> attributes, ResponseEntity entity, HttpProtocol protocol)
-
-
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:HttpResponseReturns the status-code of this response.- Specified by:
statusin classHttpResponse
-
headers
- Specified by:
headersin interfaceHttpMessage
-
attributes
- Specified by:
attributesin interfaceHttpMessage
-
entity
Description copied from class:HttpResponseReturns the entity of this response.- Specified by:
entityin interfaceHttpMessage- Specified by:
entityin interfaceHttpMessage- Specified by:
entityin classHttpResponse
-
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
-
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 HttpResponse 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
-
withProtocol
Description copied from interface:HttpMessage.MessageTransformationsReturns a copy of this message with a new protocol.- Specified by:
withProtocolin interfaceHttpMessage.MessageTransformations<HttpResponse>
-
withProtocol
-
withStatus
Description copied from class:HttpResponseReturns a copy of this instance with a new status-code.- Specified by:
withStatusin classHttpResponse
-
withStatus
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
Description copied from class:HttpResponseReturns a copy of this instance with a new entity.- Specified by:
withEntityin classHttpResponse
-
withEntity
Description copied from interface:HttpMessageReturns a copy of this message with the entity set to the given one.- Specified by:
withEntityin interfaceHttpMessage
-
withEntity
Description copied from interface:HttpMessage.MessageTransformationsReturns a copy of Self message with a new entity.- Specified by:
withEntityin interfaceHttpMessage.MessageTransformations<HttpResponse>
-
mapEntity
-
transformEntityDataBytes
public <T> HttpResponse transformEntityDataBytes(org.apache.pekko.stream.Graph<org.apache.pekko.stream.FlowShape<org.apache.pekko.util.ByteString, org.apache.pekko.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>
-
equals
-
hashCode
public int hashCode() -
toString
-
_1
-
_2
-
_3
-
_4
-