throw new IllegalArgumentException("Cannot push HttpMethod.OTHER"); } else { headers_.method(method.name());
static io.vertx.core.http.HttpMethod toVertxMethod(String method) { try { return io.vertx.core.http.HttpMethod.valueOf(method); } catch (IllegalArgumentException e) { return io.vertx.core.http.HttpMethod.OTHER; } }
@Override public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) { HttpServerRequest request = accessLogParam.getContextData().request(); if (null == request) { return EMPTY_RESULT; } HttpMethod method = request.method(); if (null == method) { return EMPTY_RESULT; } return method.toString(); } }
public VertxHttpResponse(final HttpServerResponse response, final ResteasyProviderFactory providerFactory, final HttpMethod method) { outputHeaders = new MultivaluedMapImpl<String, Object>(); this.method = method; os = (method == null || !method.equals(HttpMethod.HEAD)) ? new ChunkOutputStream(this, 1000) : null; this.response = response; this.providerFactory = providerFactory; response.exceptionHandler(t -> vertxException = t); response.closeHandler(v -> vertxException = new IOException("Connection closed")); }
private void myTenantHandle(RoutingContext ctx) { String tenant = ctx.request().getHeader(XOkapiHeaders.TENANT); String meth = ctx.request().method().name(); logger.info(meth + " " + ctx.request().uri() + " to okapi-test-module" + " for tenant " + tenant); tenantParameters = null; if (ctx.request().method().equals(HttpMethod.DELETE)) { ctx.response().setStatusCode(204); ctx.response().end();
public HttpMetricsImpl(MetricRegistry registry, String baseName, SocketAddress localAddress) { super(registry, baseName); openWebSockets = counter("open-websockets"); requests = throughputTimer("requests"); responses = new ThroughputMeter[]{ throughputMeter("responses-1xx"), throughputMeter("responses-2xx"), throughputMeter("responses-3xx"), throughputMeter("responses-4xx"), throughputMeter("responses-5xx") }; methodRequests = new EnumMap<>(HttpMethod.class); for (HttpMethod method : HttpMethod.values()) { methodRequests.put(method, throughputTimer(method.toString().toLowerCase() + "-requests")); } }
/** * Handle a vertx request by converting it into a QBit request. * * @param request request */ private void handleHttpRequest(final HttpServerRequest request) { if (debug) { setupMetrics(request); logger.debug("HttpServerVertx::handleHttpRequest::{}:{}", request.method(), request.uri()); } switch (request.method().toString()) { case "PUT": case "POST": case "OPTIONS": case "TRACE": case "DELETE": case "CONNECT": handleRequestWithBody(request); break; case "HEAD": case "GET": handleRequestWithNoBody(request); break; default: throw new IllegalStateException("method not supported yet " + request.method()); } }
public boolean requestHasBody() { // https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/ // also see: // https://www.owasp.org/index.php/Test_HTTP_Methods_(OTG-CONFIG-006) return HttpMethod.POST.equals(method) || HttpMethod.PUT.equals(method) || HttpMethod.PATCH.equals(method) || HttpMethod.TRACE.equals(method); }
NetSocket so = ar.result(); so.write( method.name() + " / HTTP/1.1\r\n" + "Connection: close\r\n" + "\r\n");
@Override public io.vertx.core.http.HttpMethod method() { if (method == null) { String sMethod = request.method().toString(); try { method = io.vertx.core.http.HttpMethod.valueOf(sMethod); } catch (IllegalArgumentException e) { method = io.vertx.core.http.HttpMethod.OTHER; } } return method; }
SignRequest signReq = createSignRequest(requestContext.getMethod().toString(), requestContext.getIpPort(), requestContext.getParams(),
private R fetchBody(RoutingContext routingContext, HttpMethod method) { R requestBody; if (HttpMethod.POST.equals(method) || HttpMethod.PUT.equals(method) || HttpMethod.PATCH.equals(method)) { requestBody = getRequestBody(routingContext); } else { requestBody = makeNewRequest(); } return requestBody; }
@Override public void writeHead(HttpMethod method, String rawMethod, String uri, MultiMap headers, String hostHeader, boolean chunked, ByteBuf content, boolean end, StreamPriority priority) { Http2Headers h = new DefaultHttp2Headers(); h.method(method != HttpMethod.OTHER ? method.name() : rawMethod); if (method == HttpMethod.CONNECT) { if (hostHeader == null) {
static io.vertx.core.http.HttpMethod toVertxMethod(String method) { try { return io.vertx.core.http.HttpMethod.valueOf(method); } catch (IllegalArgumentException e) { return io.vertx.core.http.HttpMethod.OTHER; } }
request.headers().addAll(headers); authHeaderProviders.forEach(provider -> request.headers() .addAll(provider.getSignAuthHeaders(createSignRequest(request.method().toString(), configcenter + path, headers,
/** * initialize default REST implementation for vxms * * @param vxmsShared the vxmsShared instance, containing the Vertx instance and other shared * objects per instance * @param router the Router instance * @param service the Vxms service object itself * @param routes the routes defined by the developer with the fluent API */ static void initRESTHandler( VxmsShared vxmsShared, Router router, Object service, VxmsRoutes routes) { if (VxmsRESTRoutes.class.isAssignableFrom(routes.getClass())) { VxmsRESTRoutes userRoutes = VxmsRESTRoutes.class.cast(routes); userRoutes .getDescriptors() .stream() .filter(desc -> desc.httpMethod.equals(HttpMethod.GET)) .forEach(descriptor -> initHttpGet(vxmsShared, router, descriptor)); } }
@Override public String getMethod() { return this.vertxRequest.method().name(); }
@Override public io.vertx.core.http.HttpMethod method() { if (method == null) { String sMethod = request.method().toString(); try { method = io.vertx.core.http.HttpMethod.valueOf(sMethod); } catch (IllegalArgumentException e) { method = io.vertx.core.http.HttpMethod.OTHER; } } return method; }
switch (request.method().toString()) {