Java Code Examples for io.undertow.util.StatusCodes#OK

The following examples show how to use io.undertow.util.StatusCodes#OK . 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: ProcessorLocalStatusCode.java    From galeb with Apache License 2.0 6 votes vote down vote up
int getFakeStatusCode(final String backend,
                      int statusCode,
                      long responseBytesSent,
                      Integer responseTime,
                      int maxRequestTime) {
    int statusLogged = NOT_MODIFIED;
    if (responseTime != null &&
            statusCode == StatusCodes.OK &&
            responseBytesSent <= 0 &&
            maxRequestTime > 0 &&
            responseTime > maxRequestTime) {

        statusLogged = StatusCodes.BAD_GATEWAY + OFFSET_LOCAL_ERROR;

    } else if (backend == null) {
        statusLogged = statusCode + OFFSET_LOCAL_ERROR;
    }

    return statusLogged;
}
 
Example 2
Source File: HttpMgmtProxy.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ModelNode sendPostCommand(ModelNode cmd, boolean ignoreFailure) throws Exception {
    String cmdStr = cmd.toJSONString(true);
    HttpPost post = new HttpPost(url.toURI());
    StringEntity entity = new StringEntity(cmdStr);
    entity.setContentType(APPLICATION_JSON);
    post.setEntity(entity);

    HttpResponse response = httpClient.execute(post, httpContext);
    String str = EntityUtils.toString(response.getEntity());
    if (response.getStatusLine().getStatusCode() == StatusCodes.OK || ignoreFailure) {
        return ModelNode.fromJSONString(str);
    }
    throw new Exception("Could not execute command: " + str);
}
 
Example 3
Source File: Response.java    From mangooio with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a response object with HTTP status code 200
 *
 * @return A response object {@link io.mangoo.routing.Response}
 */
public static Response withOk() {
    return new Response(StatusCodes.OK);
}