return the correct content type
This commit is contained in:
parent
8db2a217c0
commit
5a5a892cc7
|
@ -29,11 +29,17 @@ public enum XContentType {
|
|||
/**
|
||||
* A JSON based content type.
|
||||
*/
|
||||
JSON(0),
|
||||
JSON(0) {
|
||||
@Override public String restContentType() {
|
||||
return "application/json; charset=UTF-8";
|
||||
}},
|
||||
/**
|
||||
* The jackson based smile binary format. Fast and compact binary format.
|
||||
*/
|
||||
SMILE(1);
|
||||
SMILE(1) {
|
||||
@Override public String restContentType() {
|
||||
return "application/smile";
|
||||
}};
|
||||
|
||||
public static XContentType fromRestContentType(String contentType) {
|
||||
if (contentType == null) {
|
||||
|
@ -59,4 +65,6 @@ public enum XContentType {
|
|||
public int index() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public abstract String restContentType();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class XContentRestResponse extends AbstractRestResponse {
|
|||
}
|
||||
|
||||
@Override public String contentType() {
|
||||
return "application/json; charset=UTF-8";
|
||||
return builder.contentType().restContentType();
|
||||
}
|
||||
|
||||
@Override public boolean contentThreadSafe() {
|
||||
|
|
Loading…
Reference in New Issue