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

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

Introduction

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

Prototype

AsciiString name

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

Click Source Link

Usage

From source file:org.thingsplode.synapse.core.RequestMethod.java

License:Apache License

public static RequestMethod fromHttpMethod(HttpMethod httpMethod) {
    return RequestMethod.valueOf(httpMethod.name());
}

From source file:org.wso2.carbon.mss.internal.router.HttpServerTest.java

License:Open Source License

protected HttpURLConnection request(String path, HttpMethod method, boolean keepAlive) throws IOException {
    URL url = baseURI.resolve(path).toURL();
    HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
    if (method == HttpMethod.POST || method == HttpMethod.PUT) {
        urlConn.setDoOutput(true);//  ww  w.ja  v a 2 s .c  o m
    }
    urlConn.setRequestMethod(method.name());
    if (!keepAlive) {
        urlConn.setRequestProperty(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);
    }

    return urlConn;
}

From source file:org.wso2.carbon.mss.internal.router.HttpsServerTest.java

License:Open Source License

@Override
protected HttpURLConnection request(String path, HttpMethod method, boolean keepAlive) throws IOException {
    URL url = baseURI.resolve(path).toURL();
    HttpsURLConnection.setDefaultSSLSocketFactory(sslClientContext.getClientContext().getSocketFactory());
    HostnameVerifier allHostsValid = (hostname1, session) -> true;

    // Install the all-trusting host verifier
    HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
    HttpURLConnection urlConn = (HttpsURLConnection) url.openConnection();
    if (method == HttpMethod.POST || method == HttpMethod.PUT) {
        urlConn.setDoOutput(true);/*from   ww w. j av a  2  s  . c  o m*/
    }
    urlConn.setRequestMethod(method.name());
    if (!keepAlive) {
        urlConn.setRequestProperty(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);
    }
    return urlConn;
}

From source file:org.wso2.carbon.mss.internal.router.URLRewriterTest.java

License:Open Source License

private HttpURLConnection request(String path, HttpMethod method) throws IOException {
    URL url = baseURI.resolve(path).toURL();
    HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
    if (method == HttpMethod.POST || method == HttpMethod.PUT) {
        urlConn.setDoOutput(true);//from  www  .j  av  a 2s  .  c o m
    }
    urlConn.setRequestMethod(method.name());

    return urlConn;
}

From source file:ratpack.handling.internal.MethodHandler.java

License:Apache License

public void handle(Context context) {
    ratpack.http.HttpMethod requestMethod = context.getRequest().getMethod();
    if (requestMethod == method || requestMethod.name(method.getName())) {
        context.next();/*from   w ww. jav a2  s  . com*/
    } else if (requestMethod.isOptions()) {
        Response response = context.getResponse();
        response.getHeaders().add(HttpHeaderConstants.ALLOW, method);
        response.status(200).send();
    } else {
        context.clientError(405);
    }
}