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

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

Introduction

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

Prototype

HttpMethod PUT

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

Click Source Link

Document

The PUT method requests that the enclosed entity be stored under the supplied Request-URI.

Usage

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

License:Open Source License

@Override
public HttpClientRequest put(int port, String host, String requestURI) {
    return request(io.advantageous.conekt.http.HttpMethod.PUT, port, host, requestURI);
}

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

License:Open Source License

@Override
public HttpClientRequest put(int port, String host, String requestURI,
        Handler<HttpClientResponse> responseHandler) {
    return request(io.advantageous.conekt.http.HttpMethod.PUT, port, host, requestURI, responseHandler);
}

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

License:Open Source License

@Override
public HttpClientRequest put(String requestURI) {
    return request(io.advantageous.conekt.http.HttpMethod.PUT, requestURI);
}

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

License:Open Source License

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

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

License:Open Source License

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

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

License:Open Source License

@Override
public HttpClientRequest putAbs(String absoluteURI, Handler<HttpClientResponse> responseHandler) {
    return requestAbs(io.advantageous.conekt.http.HttpMethod.PUT, 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;
    }//from  w  ww .j  av a  2 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.advantageous.conekt.http.impl.HttpServerRequestImpl.java

License:Open Source License

@Override
public HttpServerRequest setExpectMultipart(boolean expect) {
    synchronized (conn) {
        checkEnded();/* www.  j ava2 s.  c om*/
        if (expect) {
            if (decoder == null) {
                String contentType = request.headers().get(HttpHeaders.Names.CONTENT_TYPE);
                if (contentType != null) {
                    HttpMethod method = request.getMethod();
                    String lowerCaseContentType = contentType.toLowerCase();
                    boolean isURLEncoded = lowerCaseContentType
                            .startsWith(HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED);
                    if ((lowerCaseContentType.startsWith(HttpHeaders.Values.MULTIPART_FORM_DATA)
                            || isURLEncoded)
                            && (method.equals(HttpMethod.POST) || method.equals(HttpMethod.PUT)
                                    || method.equals(HttpMethod.PATCH) || method.equals(HttpMethod.DELETE))) {
                        decoder = new HttpPostRequestDecoder(new DataFactory(), request);
                    }
                }
            }
        } else {
            decoder = null;
        }
        return this;
    }
}

From source file:io.crate.protocols.http.HttpBlobHandler.java

License:Apache License

private boolean possibleRedirect(HttpRequest request, String index, String digest) {
    HttpMethod method = request.method();
    if (method.equals(HttpMethod.GET) || method.equals(HttpMethod.HEAD)
            || (method.equals(HttpMethod.PUT) && HttpUtil.is100ContinueExpected(request))) {
        String redirectAddress;//from ww w  . j a v a  2  s .  co  m
        try {
            redirectAddress = blobService.getRedirectAddress(index, digest);
        } catch (MissingHTTPEndpointException ex) {
            simpleResponse(HttpResponseStatus.BAD_GATEWAY);
            return true;
        }

        if (redirectAddress != null) {
            LOGGER.trace("redirectAddress: {}", redirectAddress);
            sendRedirect(activeScheme + redirectAddress);
            return true;
        }
    }
    return false;
}

From source file:io.crate.protocols.http.HttpBlobHandler.java

License:Apache License

private void handleBlobRequest(HttpRequest request, @Nullable HttpContent content) throws IOException {
    if (possibleRedirect(request, index, digest)) {
        reset();/* w w  w. j  a v  a2s . c  o m*/
        return;
    }

    HttpMethod method = request.method();
    if (method.equals(HttpMethod.GET)) {
        get(request, index, digest);
        reset();
    } else if (method.equals(HttpMethod.HEAD)) {
        head(index, digest);
        reset();
    } else if (method.equals(HttpMethod.PUT)) {
        put(content, index, digest);
    } else if (method.equals(HttpMethod.DELETE)) {
        delete(index, digest);
        reset();
    } else {
        simpleResponse(HttpResponseStatus.METHOD_NOT_ALLOWED);
        reset();
    }
}