return the correct content type

This commit is contained in:
kimchy 2010-09-15 12:55:36 +02:00
parent 8db2a217c0
commit 5a5a892cc7
2 changed files with 11 additions and 3 deletions

View File

@ -29,11 +29,17 @@ public enum XContentType {
/** /**
* A JSON based content type. * 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. * 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) { public static XContentType fromRestContentType(String contentType) {
if (contentType == null) { if (contentType == null) {
@ -59,4 +65,6 @@ public enum XContentType {
public int index() { public int index() {
return index; return index;
} }
public abstract String restContentType();
} }

View File

@ -64,7 +64,7 @@ public class XContentRestResponse extends AbstractRestResponse {
} }
@Override public String contentType() { @Override public String contentType() {
return "application/json; charset=UTF-8"; return builder.contentType().restContentType();
} }
@Override public boolean contentThreadSafe() { @Override public boolean contentThreadSafe() {