Example usage for io.netty.handler.codec.http HttpMethod OPTIONS

List of usage examples for io.netty.handler.codec.http HttpMethod OPTIONS

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpMethod OPTIONS.

Prototype

HttpMethod OPTIONS

To view the source code for io.netty.handler.codec.http HttpMethod OPTIONS.

Click Source Link

Document

The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI.

Usage

From source file:io.advantageous.conekt.http.impl.HttpClientImpl.java

License:Open Source License

@Override
public HttpClientRequest options(String requestURI, Handler<HttpClientResponse> responseHandler) {
    return request(io.advantageous.conekt.http.HttpMethod.OPTIONS, requestURI, responseHandler);
}

From source file:io.advantageous.conekt.http.impl.HttpClientImpl.java

License:Open Source License

@Override
public HttpClientRequest optionsAbs(String absoluteURI) {
    return requestAbs(io.advantageous.conekt.http.HttpMethod.OPTIONS, absoluteURI);
}

From source file:io.advantageous.conekt.http.impl.HttpClientImpl.java

License:Open Source License

@Override
public HttpClientRequest optionsAbs(String absoluteURI, Handler<HttpClientResponse> responseHandler) {
    return requestAbs(io.advantageous.conekt.http.HttpMethod.OPTIONS, absoluteURI, responseHandler);
}

From source file:io.advantageous.conekt.http.impl.HttpClientRequestImpl.java

License:Open Source License

private HttpMethod toNettyHttpMethod(io.advantageous.conekt.http.HttpMethod method) {
    switch (method) {
    case CONNECT: {
        return HttpMethod.CONNECT;
    }//  ww  w .  j av a2 s  .c o  m
    case GET: {
        return HttpMethod.GET;
    }
    case PUT: {
        return HttpMethod.PUT;
    }
    case POST: {
        return HttpMethod.POST;
    }
    case DELETE: {
        return HttpMethod.DELETE;
    }
    case HEAD: {
        return HttpMethod.HEAD;
    }
    case OPTIONS: {
        return HttpMethod.OPTIONS;
    }
    case TRACE: {
        return HttpMethod.TRACE;
    }
    case PATCH: {
        return HttpMethod.PATCH;
    }
    default:
        throw new IllegalArgumentException();
    }
}

From source file:io.vertx.core.http.impl.HttpUtils.java

License:Open Source License

static HttpMethod toNettyHttpMethod(io.vertx.core.http.HttpMethod method, String rawMethod) {
    switch (method) {
    case CONNECT: {
        return HttpMethod.CONNECT;
    }/*from   w w w.ja  v  a  2s .  c  om*/
    case GET: {
        return HttpMethod.GET;
    }
    case PUT: {
        return HttpMethod.PUT;
    }
    case POST: {
        return HttpMethod.POST;
    }
    case DELETE: {
        return HttpMethod.DELETE;
    }
    case HEAD: {
        return HttpMethod.HEAD;
    }
    case OPTIONS: {
        return HttpMethod.OPTIONS;
    }
    case TRACE: {
        return HttpMethod.TRACE;
    }
    case PATCH: {
        return HttpMethod.PATCH;
    }
    default: {
        return HttpMethod.valueOf(rawMethod);
    }
    }
}

From source file:org.apache.hyracks.http.server.AbstractServlet.java

License:Apache License

@Override
public void handle(IServletRequest request, IServletResponse response) {
    try {//from w  w w. j  a  va 2  s .  co  m
        final HttpMethod method = request.getHttpRequest().method();
        if (HttpMethod.GET.equals(method)) {
            get(request, response);
        } else if (HttpMethod.HEAD.equals(method)) {
            head(request, response);
        } else if (HttpMethod.POST.equals(method)) {
            post(request, response);
        } else if (HttpMethod.PUT.equals(method)) {
            put(request, response);
        } else if (HttpMethod.DELETE.equals(method)) {
            delete(request, response);
        } else if (HttpMethod.OPTIONS.equals(method)) {
            options(request, response);
        } else {
            notAllowed(method, response);
        }
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Unhandled exception", e);
        response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
    } catch (Throwable th) { //NOSONAR Just logging and then throwing again
        try {
            LOGGER.log(Level.WARNING, "Unhandled throwable", th);
        } catch (Throwable loggingFailure) {// NOSONAR... swallow logging failure
        }
        throw th;
    }
}

From source file:org.apache.hyracks.http.server.AbstractServlet.java

License:Apache License

@SuppressWarnings("squid:S1172")
protected void options(IServletRequest request, IServletResponse response) throws Exception {
    // designed to be extended but an error in standard case
    notAllowed(HttpMethod.OPTIONS, response);
}

From source file:org.asynchttpclient.Dsl.java

License:Open Source License

public static RequestBuilder options(String url) {
    return request(HttpMethod.OPTIONS.name(), url);
}

From source file:org.elasticsearch.hadoop.http.netty4.cors.Netty4CorsHandler.java

License:Apache License

private static boolean isPreflightRequest(final HttpRequest request) {
    final HttpHeaders headers = request.headers();
    return request.method().equals(HttpMethod.OPTIONS) && headers.contains(HttpHeaderNames.ORIGIN)
            && headers.contains(HttpHeaderNames.ACCESS_CONTROL_REQUEST_METHOD);
}

From source file:org.elasticsearch.hadoop.http.netty4.Netty4HttpRequest.java

License:Apache License

@Override
public Method method() {
    HttpMethod httpMethod = request.method();
    if (httpMethod == HttpMethod.GET)
        return Method.GET;

    if (httpMethod == HttpMethod.POST)
        return Method.POST;

    if (httpMethod == HttpMethod.PUT)
        return Method.PUT;

    if (httpMethod == HttpMethod.DELETE)
        return Method.DELETE;

    if (httpMethod == HttpMethod.HEAD) {
        return Method.HEAD;
    }/* w  ww.  ja  v a2s. c  o  m*/

    if (httpMethod == HttpMethod.OPTIONS) {
        return Method.OPTIONS;
    }

    return Method.GET;
}