Class HttpResponse
java.lang.Object
org.apache.pekko.http.javadsl.model.HttpResponse
- All Implemented Interfaces:
HttpMessage,HttpMessage.MessageTransformations<HttpResponse>
- Direct Known Subclasses:
HttpResponse
public abstract class HttpResponse
extends Object
implements HttpMessage, HttpMessage.MessageTransformations<HttpResponse>
Represents an Http response.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.pekko.http.javadsl.model.HttpMessage
HttpMessage.DiscardedEntity, HttpMessage.MessageTransformations<Self> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpResponsecreate()Returns a default response to be changed using the `withX` methods.abstract HttpEncodingencoding()Returns the content encoding as specified by the Content-Encoding header.abstract ResponseEntityentity()Returns the entity of this response.abstract StatusCodestatus()Returns the status-code of this response.abstract HttpResponsewithEntity(ResponseEntity entity) Returns a copy of this instance with a new entity.abstract HttpResponsewithStatus(int statusCode) Returns a copy of this instance with a new status-code.abstract HttpResponsewithStatus(StatusCode statusCode) Returns a copy of this instance with a new status-code.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pekko.http.javadsl.model.HttpMessage
discardEntityBytes, discardEntityBytes, getAttribute, getHeader, getHeader, getHeaders, getHeaders, isRequest, isResponse, protocolMethods inherited from interface org.apache.pekko.http.javadsl.model.HttpMessage.MessageTransformations
addAttribute, addCredentials, addHeader, addHeaders, removeAttribute, removeHeader, toStrict, toStrict, toStrict, toStrict, transformEntityDataBytes, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withEntity, withHeaders, withProtocol
-
Constructor Details
-
HttpResponse
public HttpResponse()
-
-
Method Details
-
status
Returns the status-code of this response. -
entity
Returns the entity of this response.- Specified by:
entityin interfaceHttpMessage
-
withStatus
Returns a copy of this instance with a new status-code. -
withStatus
Returns a copy of this instance with a new status-code. -
withEntity
Returns a copy of this instance with a new entity. -
encoding
Returns the content encoding as specified by the Content-Encoding header. If no Content-Encoding header is present the default value 'identity' is returned. -
create
Returns a default response to be changed using the `withX` methods.
-