OLINGO-939: Avoiding to use contentType.getType method, instead use contentType.toContentTypeString for string form of the content-type

This commit is contained in:
Ramesh Reddy 2016-04-21 15:26:15 -05:00
parent e4f95706a9
commit 01e27bb6ee
5 changed files with 7 additions and 10 deletions

View File

@ -114,13 +114,10 @@ public class EntityResponse extends ServiceResponse {
// Note that if media written just like Stream, but on entity URL
// 8.2.8.7
if (this.returnRepresentation == ReturnRepresentation.MINIMAL ||
this.returnRepresentation == ReturnRepresentation.NONE) {
if (this.returnRepresentation == ReturnRepresentation.MINIMAL) {
writeNoContent(false);
writeHeader(HttpHeader.LOCATION, locationHeader);
if (this.returnRepresentation == ReturnRepresentation.MINIMAL) {
writeHeader("Preference-Applied", "return=minimal"); //$NON-NLS-1$ //$NON-NLS-2$
}
writeHeader("Preference-Applied", "return=minimal"); //$NON-NLS-1$ //$NON-NLS-2$
// 8.3.3
writeHeader("OData-EntityId", entity.getId().toASCIIString()); //$NON-NLS-1$
close();
@ -162,7 +159,7 @@ public class EntityResponse extends ServiceResponse {
public void writeError(ODataServerError error) {
try {
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.getType());
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.toContentTypeString());
writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true);
} catch (SerializerException e) {
writeServerError(true);

View File

@ -85,7 +85,7 @@ public class EntitySetResponse extends ServiceResponse {
public void writeError(ODataServerError error) {
try {
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.getType());
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.toContentTypeString());
writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true);
} catch (SerializerException e) {
writeServerError(true);

View File

@ -64,7 +64,7 @@ public class MetadataResponse extends ServiceResponse {
public void writeError(ODataServerError error) {
try {
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.getType());
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.toContentTypeString());
writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true);
} catch (SerializerException e) {
writeServerError(true);

View File

@ -160,7 +160,7 @@ public class PropertyResponse extends ServiceResponse {
public void writeError(ODataServerError error) {
try {
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.getType());
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.toContentTypeString());
writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true);
} catch (SerializerException e) {
writeServerError(true);

View File

@ -65,7 +65,7 @@ public class ServiceDocumentResponse extends ServiceResponse {
public void writeError(ODataServerError error) {
try {
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.getType());
writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.toContentTypeString());
writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true);
} catch (SerializerException e) {
writeServerError(true);