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

The following examples show how to use org.apache.olingo.commons.api.http.HttpStatusCode#getStatusCode() . 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: AbstractProducerCustomizer.java    From syndesis with Apache License 2.0 6 votes vote down vote up
protected void afterProducer(Exchange exchange) throws IOException {
    Message in = exchange.getIn();

    JsonNodeFactory factory = JsonNodeFactory.instance;
    ObjectNode statusNode = factory.objectNode();

    int response = 400;
    String info = "No Information";
    HttpStatusCode code = in.getBody(HttpStatusCode.class);
    if (code != null) {
        response = code.getStatusCode();
        info = code.getInfo();
    }

    statusNode.put("Response", response);
    statusNode.put("Information", info);

    String json = OBJECT_MAPPER.writeValueAsString(statusNode);
    in.setBody(json);
}
 
Example 2
Source File: AbstractODataRouteTest.java    From syndesis with Apache License 2.0 4 votes vote down vote up
protected String createResponseJson(HttpStatusCode statusCode) {
    return OPEN_BRACE +
        "\"Response\"" + COLON + statusCode.getStatusCode() + COMMA +
        "\"Information\"" + COLON + SPEECH_MARK + statusCode.getInfo() + SPEECH_MARK +
    CLOSE_BRACE;
}
 
Example 3
Source File: DataProvider.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
public DataProviderException(final String message, final HttpStatusCode statusCode) {
  super(message, statusCode.getStatusCode(), Locale.ROOT);
}
 
Example 4
Source File: DataProvider.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
public DataProviderException(final String message, final HttpStatusCode statusCode, final Throwable throwable) {
  super(message, statusCode.getStatusCode(), Locale.ROOT, throwable);
}