private void buildObjectData(StringBuilder sb, ProcessorResult result, Map<String, String> renderMap) { String location = result.getHeaders().get(LOCATION); sb.append(HTTP_VERSION + " ").append(result.getStatus().toString().replace("_", " ")).append(NEW_LINE); sb.append(CONTENT_TYPE).append(COLON).append(renderMap.get(FORMAT)).append(NEW_LINE); if (location != null) { sb.append(LOCATION).append(COLON).append(location).append(NEW_LINE); } sb.append(CONTENT_LENGTH).append(COLON).append(contentLength).append(NEW_LINE); sb.append(NEW_LINE); if (renderMap.get(BODY) != null) { sb.append(renderMap.get(BODY)).append(NEW_LINE).append(NEW_LINE); } else { // DELETE shouldn't contain message inside the batch body sb.append(NEW_LINE); } }
private void buildObjectData(StringBuilder sb, ProcessorResult result, Map<String, String> renderMap) { String location = result.getHeaders().get(LOCATION); sb.append(HTTP_VERSION + " ").append(result.getStatus().toString().replace("_", " ")).append(NEW_LINE); sb.append(CONTENT_TYPE).append(COLON).append(renderMap.get(FORMAT)).append(NEW_LINE); if (location != null) { sb.append(LOCATION).append(COLON).append(location).append(NEW_LINE); } sb.append(CONTENT_LENGTH).append(COLON).append(contentLength).append(NEW_LINE); sb.append(NEW_LINE); if (renderMap.get(BODY) != null) { sb.append(renderMap.get(BODY)).append(NEW_LINE).append(NEW_LINE); } else { // DELETE shouldn't contain message inside the batch body sb.append(NEW_LINE); } }
private void buildException(ODataException ex, StringBuilder sb, ProcessorResult result) { LOG.debug("{} was found. Start to create an error batch request"); if (result != null) { sb.append(HTTP_VERSION + " ").append(result.getStatus().toString().replace("_", " ")).append(NEW_LINE); } else if (ex.getCode() != null) { if (ex.getCode().toString().equals("ENTITY_NOT_FOUND_ERROR")) { sb.append(HTTP_VERSION + " ") .append(ODataResponse.Status.NOT_FOUND.toString().replace("_", " ")).append(NEW_LINE); } else { sb.append(HTTP_VERSION + " ") .append(ODataResponse.Status.BAD_REQUEST.toString().replace("_", " ")).append(NEW_LINE); } } sb.append(CONTENT_TYPE_HTTP).append(NEW_LINE); sb.append(CONTENT_LENGTH).append(COLON).append(contentLength).append(NEW_LINE).append(NEW_LINE); sb.append(ex.getMessage()).append(NEW_LINE); }
private void buildException(ODataException ex, StringBuilder sb, ProcessorResult result) { LOG.debug("{} was found. Start to create an error batch request"); if (result != null) { sb.append(HTTP_VERSION + " ").append(result.getStatus().toString().replace("_", " ")).append(NEW_LINE); } else if (ex.getCode() != null) { if (ex.getCode().toString().equals("ENTITY_NOT_FOUND_ERROR")) { sb.append(HTTP_VERSION + " ") .append(ODataResponse.Status.NOT_FOUND.toString().replace("_", " ")).append(NEW_LINE); } else { sb.append(HTTP_VERSION + " ") .append(ODataResponse.Status.BAD_REQUEST.toString().replace("_", " ")).append(NEW_LINE); } } sb.append(CONTENT_TYPE_HTTP).append(NEW_LINE); sb.append(CONTENT_LENGTH).append(COLON).append(contentLength).append(NEW_LINE).append(NEW_LINE); sb.append(ex.getMessage()).append(NEW_LINE); }
@Override public String toString() { return status.toString(); } }
@Override public String toString() { return status.toString(); } }