Java Code Examples for org.apache.olingo.commons.api.http.HttpStatusCode#fromStatusCode()

The following examples show how to use org.apache.olingo.commons.api.http.HttpStatusCode#fromStatusCode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugTabResponse.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
public DebugTabResponse(final ODataResponse applicationResponse) {
  response = applicationResponse;
  if (response != null) {
    status = HttpStatusCode.fromStatusCode(response.getStatusCode());
    headers = response.getAllHeaders();
  } else {
    status = HttpStatusCode.INTERNAL_SERVER_ERROR;
    headers = Collections.emptyMap();
  }
}
 
Example 2
Source File: BatchResponseSerializer.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private String getStatusCodeInfo(final ODataResponse response) {
  HttpStatusCode status = HttpStatusCode.fromStatusCode(response.getStatusCode());
  if (status == null) {
    throw new ODataRuntimeException("Invalid status code in response '" + response.getStatusCode() + "'");
  }
  return status.getInfo();
}
 
Example 3
Source File: AsyncResponseSerializer.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
private void appendStatusLine(final ODataResponse response, final ByteArrayOutputStream buffer)
    throws IOException {
  HttpStatusCode status = HttpStatusCode.fromStatusCode(response.getStatusCode());
  append(HTTP_VERSION + SP + response.getStatusCode() + SP + status + CRLF, buffer);
}