final Headers headers = httpExchange.getRequestHeaders();
final String accept = headers.getFirst(ACCEPT_HEADER);
- String serializedAccount = "";
- if (accept.equals(AccountResourceSerializer.CONTENT_TYPE_JSON)) {
- serializedAccount = this.jsonSerializer(accountResource);
-
- this.setJSONContentType(httpExchange, CONTENT_TYPE_JSON);
- }
-
+ String serializedAccount;
if (accept.equals(AccountResourceSerializer.CONTENT_TYPE_XML)) {
serializedAccount = this.xmlSerializer(accountResource);
this.setJSONContentType(httpExchange, CONTENT_TYPE_XML);
+ } else {
+ serializedAccount = this.jsonSerializer(accountResource);
+
+ this.setJSONContentType(httpExchange, CONTENT_TYPE_JSON);
}
return serializedAccount;