odataResponse =
dispatcher.dispatch(method, uriInfo, request.getBody(), request.getContentType(), acceptContentType
.toContentTypeString());
context.stopRuntimeMeasurement(timingHandle2);
ODataResponseBuilder extendedResponse = ODataResponse.fromResponse(odataResponse);
final UriType uriType = uriInfo.getUriType();
final String location =
(method == ODataHttpMethod.POST && (uriType == UriType.URI1 || uriType == UriType.URI6B)) ? odataResponse
.getIdLiteral() : null;
final HttpStatusCodes s = getStatusCode(odataResponse, method, uriType);
extendedResponse = extendedResponse.idLiteral(location).status(s);
if (!odataResponse.containsHeader(ODataHttpHeaders.DATASERVICEVERSION)) {
extendedResponse = extendedResponse.header(ODataHttpHeaders.DATASERVICEVERSION, serverDataServiceVersion);
}
if (!HttpStatusCodes.NO_CONTENT.equals(s) && !odataResponse.containsHeader(HttpHeaders.CONTENT_TYPE)) {
extendedResponse.header(HttpHeaders.CONTENT_TYPE, acceptContentType.toContentTypeString());
}
odataResponse = extendedResponse.build();
} catch (final Exception e) {
exception = e;
odataResponse = new ODataExceptionWrapper(context, request.getQueryParameters(), request.getAcceptHeaders())
.wrapInExceptionResponse(e);
}