forked from akka/akka-http
/
HttpResponse.java
51 lines (42 loc) · 1.39 KB
/
HttpResponse.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com>
*/
package akka.http.javadsl.model;
import akka.http.impl.util.JavaAccessors;
import akka.http.javadsl.model.headers.HttpEncoding;
/**
* Represents an Http response.
*/
public abstract class HttpResponse implements HttpMessage, HttpMessage.MessageTransformations<HttpResponse> {
/**
* Returns the status-code of this response.
*/
public abstract StatusCode status();
/**
* Returns the entity of this response.
*/
public abstract ResponseEntity entity();
/**
* Returns a copy of this instance with a new status-code.
*/
public abstract HttpResponse withStatus(StatusCode statusCode);
/**
* Returns a copy of this instance with a new status-code.
*/
public abstract HttpResponse withStatus(int statusCode);
/**
* Returns a copy of this instance with a new entity.
*/
public abstract HttpResponse withEntity(ResponseEntity entity);
/**
* Returns the content encoding as specified by the Content-Encoding header. If no Content-Encoding header is present the
* default value 'identity' is returned.
*/
public abstract HttpEncoding encoding();
/**
* Returns a default response to be changed using the `withX` methods.
*/
public static HttpResponse create() {
return JavaAccessors.HttpResponse();
}
}