Example usage for io.vertx.core.http HttpMethod PATCH

List of usage examples for io.vertx.core.http HttpMethod PATCH

Introduction

In this page you can find the example usage for io.vertx.core.http HttpMethod PATCH.

Prototype

HttpMethod PATCH

To view the source code for io.vertx.core.http HttpMethod PATCH.

Click Source Link

Usage

From source file:com.atypon.wayf.verticle.WayfVerticle.java

License:Apache License

private void startWebApp(Handler<AsyncResult<HttpServer>> next) {
    Guice.createInjector(new WayfGuiceModule()).injectMembers(this);
    routingProviders = Lists.newArrayList(identityProviderUsageRouting, identityProviderRouting,
            deviceRoutingProvider, publisherRouting, deviceAccessRouting, publisherRegistrationRouting,
            userRouting);//from  ww w .ja va 2  s. c om
    // Create a router object.
    Router router = Router.router(vertx);

    CorsHandler handler = CorsHandler.create("*").allowCredentials(true)
            .allowedMethod(io.vertx.core.http.HttpMethod.PATCH)
            .allowedMethod(io.vertx.core.http.HttpMethod.OPTIONS)
            .allowedMethod(io.vertx.core.http.HttpMethod.DELETE).exposedHeaders(Sets.newHashSet("X-Device-Id"))
            .allowedHeader("Access-Control-Request-Method")
            .allowedHeader("Access-Control-Allow-AuthenticationCredentials")
            .allowedHeader("Access-Control-Allow-Origin").allowedHeader("Access-Control-Allow-Headers")
            .allowedHeader("Content-Type").allowedHeader("Authorization");

    router.route().handler(handler);
    router.route().handler(CookieHandler.create());

    LOG.debug("Adding routes");

    routingProviders.forEach((routingProvider) -> routingProvider.addRoutings(router));

    LOG.debug("Adding default error handler to routes");
    for (Route route : router.getRoutes()) {
        route.failureHandler((rc) -> responseWriter.buildFailure(rc));
        LOG.debug("Found path {}", route);
    }

    router.route("/public/*").handler(StaticHandler.create("public"));

    LOG.debug("Starting HTTP server");
    // Create the HTTP server and pass the "accept" method to the request handler.
    vertx.createHttpServer().requestHandler(router::accept).listen(wayfPort, next::handle);
}

From source file:io.gravitee.gateway.http.vertx.VertxHttpClient.java

License:Apache License

private HttpMethod convert(io.gravitee.common.http.HttpMethod httpMethod) {
    switch (httpMethod) {
    case CONNECT:
        return HttpMethod.CONNECT;
    case DELETE:/*from  w  ww .ja va 2 s. c  om*/
        return HttpMethod.DELETE;
    case GET:
        return HttpMethod.GET;
    case HEAD:
        return HttpMethod.HEAD;
    case OPTIONS:
        return HttpMethod.OPTIONS;
    case PATCH:
        return HttpMethod.PATCH;
    case POST:
        return HttpMethod.POST;
    case PUT:
        return HttpMethod.PUT;
    case TRACE:
        return HttpMethod.TRACE;
    }

    return null;
}