Search in sources :

Example 1 with GET

use of io.netty.handler.codec.http.HttpMethod.GET in project styx by ExpediaGroup.

the class HttpPipelineHandlerTest method mapsUnrecoverableInternalErrorsToInternalServerError500ResponseCode.

@Test
public void mapsUnrecoverableInternalErrorsToInternalServerError500ResponseCode() {
    HttpHandler handler = (request, context) -> {
        throw new RuntimeException("Forced exception for testing");
    };
    EmbeddedChannel channel = buildEmbeddedChannel(handlerWithMocks(handler));
    channel.writeInbound(httpRequestAsBuf(GET, "http://foo.com/"));
    DefaultHttpResponse response = (DefaultHttpResponse) channel.readOutbound();
    assertThat(response.status(), is(io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR));
    verify(responseEnhancer).enhance(any(LiveHttpResponse.Transformer.class), any(LiveHttpRequest.class));
    verify(errorListener, only()).proxyErrorOccurred(any(LiveHttpRequest.class), any(InetSocketAddress.class), eq(INTERNAL_SERVER_ERROR), any(RuntimeException.class));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) HttpResponse(com.hotels.styx.api.HttpResponse) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) LiveHttpResponse.response(com.hotels.styx.api.LiveHttpResponse.response) State(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State) ArgumentMatchers.nullable(org.mockito.ArgumentMatchers.nullable) REQUEST_TIMEOUT(com.hotels.styx.api.HttpResponseStatus.REQUEST_TIMEOUT) SENDING_RESPONSE(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.SENDING_RESPONSE) WARN(ch.qos.logback.classic.Level.WARN) TERMINATED(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.TERMINATED) Arrays.asList(java.util.Arrays.asList) Matchers.eq(org.mockito.Matchers.eq) Is.is(org.hamcrest.core.Is.is) LiveHttpRequest.get(com.hotels.styx.api.LiveHttpRequest.get) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) NettyToStyxRequestDecoder(com.hotels.styx.server.netty.codec.NettyToStyxRequestDecoder) BAD_REQUEST(com.hotels.styx.api.HttpResponseStatus.BAD_REQUEST) Mockito.only(org.mockito.Mockito.only) DecoderException(io.netty.handler.codec.DecoderException) HttpHandler(com.hotels.styx.api.HttpHandler) Gauge(io.micrometer.core.instrument.Gauge) SSLHandshakeException(javax.net.ssl.SSLHandshakeException) REQUEST_ENTITY_TOO_LARGE(com.hotels.styx.api.HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE) UtilKt.append(com.hotels.styx.javaconvenience.UtilKt.append) TooLongFrameException(io.netty.handler.codec.TooLongFrameException) InetSocketAddress(java.net.InetSocketAddress) Test(org.junit.jupiter.api.Test) Matchers.any(org.mockito.Matchers.any) List(java.util.List) CONTENT_LENGTH(com.hotels.styx.api.HttpHeaderNames.CONTENT_LENGTH) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) DefaultHttpResponse(io.netty.handler.codec.http.DefaultHttpResponse) DO_NOT_MODIFY_RESPONSE(com.hotels.styx.server.netty.connectors.ResponseEnhancer.DO_NOT_MODIFY_RESPONSE) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Optional(java.util.Optional) HttpErrorStatusListener(com.hotels.styx.server.HttpErrorStatusListener) RequestTimeoutException(com.hotels.styx.server.RequestTimeoutException) ACCEPTING_REQUESTS(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.ACCEPTING_REQUESTS) Mockito.mock(org.mockito.Mockito.mock) WAITING_FOR_RESPONSE(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.WAITING_FOR_RESPONSE) LoggingTestSupport(com.hotels.styx.support.matchers.LoggingTestSupport) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IsEmptyCollection.empty(org.hamcrest.collection.IsEmptyCollection.empty) CompletableFuture(java.util.concurrent.CompletableFuture) Mockito.spy(org.mockito.Mockito.spy) Mockito.verifyZeroInteractions(org.mockito.Mockito.verifyZeroInteractions) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) LoggingEventMatcher.loggingEvent(com.hotels.styx.support.matchers.LoggingEventMatcher.loggingEvent) HttpMessageSupport.httpRequestAsBuf(com.hotels.styx.support.netty.HttpMessageSupport.httpRequestAsBuf) ArgumentCaptor(org.mockito.ArgumentCaptor) JustATestException(com.hotels.styx.support.JustATestException) EmitterProcessor(reactor.core.publisher.EmitterProcessor) CONNECTION(com.hotels.styx.api.HttpHeaderNames.CONNECTION) Matchers.anyObject(org.mockito.Matchers.anyObject) HttpResponseWriterFactory(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.HttpResponseWriterFactory) StyxClientException(com.hotels.styx.client.StyxClientException) CLOSE(com.hotels.styx.api.HttpHeaderValues.CLOSE) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) RequestStatsCollector(com.hotels.styx.server.RequestStatsCollector) INFO(ch.qos.logback.classic.Level.INFO) Eventual(com.hotels.styx.api.Eventual) INTERNAL_SERVER_ERROR(com.hotels.styx.api.HttpResponseStatus.INTERNAL_SERVER_ERROR) GET(io.netty.handler.codec.http.HttpMethod.GET) UTF_8(java.nio.charset.StandardCharsets.UTF_8) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) BadRequestException(com.hotels.styx.server.BadRequestException) ChannelFuture(io.netty.channel.ChannelFuture) Mockito.verify(org.mockito.Mockito.verify) ContentOverflowException(com.hotels.styx.api.ContentOverflowException) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) Channel(io.netty.channel.Channel) Flux(reactor.core.publisher.Flux) AfterEach(org.junit.jupiter.api.AfterEach) Mockito.never(org.mockito.Mockito.never) MeterRegistry(com.hotels.styx.api.MeterRegistry) SENDING_RESPONSE_CLIENT_CLOSED(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.SENDING_RESPONSE_CLIENT_CLOSED) OK(com.hotels.styx.api.HttpResponseStatus.OK) CentralisedMetrics(com.hotels.styx.metrics.CentralisedMetrics) ChannelHandler(io.netty.channel.ChannelHandler) HttpRequestDecoder(io.netty.handler.codec.http.HttpRequestDecoder) HttpObjectAggregator(io.netty.handler.codec.http.HttpObjectAggregator) BAD_GATEWAY(com.hotels.styx.api.HttpResponseStatus.BAD_GATEWAY) LiveHttpRequest(com.hotels.styx.api.LiveHttpRequest) HttpHandler(com.hotels.styx.api.HttpHandler) DefaultHttpResponse(io.netty.handler.codec.http.DefaultHttpResponse) LiveHttpRequest(com.hotels.styx.api.LiveHttpRequest) InetSocketAddress(java.net.InetSocketAddress) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Test(org.junit.jupiter.api.Test)

Example 2 with GET

use of io.netty.handler.codec.http.HttpMethod.GET in project GraphScope by alibaba.

the class MaxGraphHttpGremlinEndpointHandler method channelRead.

@Override
public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
    if (msg instanceof FullHttpRequest) {
        final FullHttpRequest req = (FullHttpRequest) msg;
        if ("/favicon.ico".equals(req.uri())) {
            sendError(ctx, NOT_FOUND, "Gremlin Server doesn't have a favicon.ico");
            ReferenceCountUtil.release(msg);
            return;
        }
        if (HttpUtil.is100ContinueExpected(req)) {
            ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE));
        }
        if (req.method() != GET && req.method() != POST && req.method() != HEAD) {
            sendError(ctx, METHOD_NOT_ALLOWED, METHOD_NOT_ALLOWED.toString());
            ReferenceCountUtil.release(msg);
            return;
        }
        final Quartet<String, Map<String, Object>, String, Map<String, String>> requestArguments;
        try {
            requestArguments = getRequestArguments(req);
        } catch (IllegalArgumentException iae) {
            sendError(ctx, BAD_REQUEST, iae.getMessage());
            ReferenceCountUtil.release(msg);
            return;
        }
        final String acceptString = Optional.ofNullable(req.headers().get("Accept")).orElse("application/json");
        final Pair<String, MessageTextSerializer> serializer = chooseSerializer(acceptString);
        if (null == serializer) {
            sendError(ctx, BAD_REQUEST, String.format("no serializer for requested Accept header: %s", acceptString));
            ReferenceCountUtil.release(msg);
            return;
        }
        final String origin = req.headers().get(ORIGIN);
        final boolean keepAlive = HttpUtil.isKeepAlive(req);
        // not using the req any where below here - assume it is safe to release at this point.
        ReferenceCountUtil.release(msg);
        try {
            logger.debug("Processing request containing script [{}] and bindings of [{}] on {}", requestArguments.getValue0(), requestArguments.getValue1(), Thread.currentThread().getName());
            if (settings.authentication.enableAuditLog) {
                String address = ctx.channel().remoteAddress().toString();
                if (address.startsWith("/") && address.length() > 1)
                    address = address.substring(1);
                auditLogger.info("User with address {} requested: {}", address, requestArguments.getValue0());
            }
            final ChannelPromise promise = ctx.channel().newPromise();
            final AtomicReference<Object> resultHolder = new AtomicReference<>();
            promise.addListener(future -> {
                // processing of the exception
                if (future.isSuccess()) {
                    logger.debug("Preparing HTTP response for request with script [{}] and" + " bindings of [{}] with result of [{}] on [{}]", requestArguments.getValue0(), requestArguments.getValue1(), resultHolder.get(), Thread.currentThread().getName());
                    ByteBuf content = (ByteBuf) resultHolder.get();
                    final FullHttpResponse response = req.method() == GET ? new DefaultFullHttpResponse(HTTP_1_1, OK, content) : new DefaultFullHttpResponse(HTTP_1_1, OK);
                    response.headers().set(CONTENT_TYPE, serializer.getValue0());
                    response.headers().set(CONTENT_LENGTH, content.readableBytes());
                    // handle cors business
                    if (origin != null)
                        response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, origin);
                    if (!keepAlive) {
                        ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
                    } else {
                        response.headers().set(CONNECTION, HttpHeaderValues.KEEP_ALIVE);
                        ctx.writeAndFlush(response);
                    }
                }
            });
            final Timer.Context timerContext = evalOpTimer.time();
            final Bindings bindings;
            try {
                bindings = createBindings(requestArguments.getValue1(), requestArguments.getValue3());
            } catch (IllegalStateException iae) {
                sendError(ctx, BAD_REQUEST, iae.getMessage());
                ReferenceCountUtil.release(msg);
                return;
            }
            // provide a transform function to serialize to message - this will force
            // serialization to occur
            // in the same thread as the eval. after the CompletableFuture is returned from the
            // eval the result
            // is ready to be written as a ByteBuf directly to the response.  nothing should be
            // blocking here.
            String script = requestArguments.getValue0();
            final CompletableFuture<Object> evalFuture = gremlinExecutor.eval(script, requestArguments.getValue2(), bindings, FunctionUtils.wrapFunction(o -> {
                // stopping the timer here is roughly equivalent to
                // where the timer would have been stopped for
                // this metric in other contexts.  we just want to
                // measure eval time not serialization time.
                timerContext.stop();
                logger.debug("Transforming result of request with script" + " [{}] and bindings of [{}] with result" + " of [{}] on [{}]", requestArguments.getValue0(), requestArguments.getValue1(), o, Thread.currentThread().getName());
                List<Object> resultList = opProcessor.processHttpGraphTraversal(script, o, settings.evaluationTimeout, req);
                final ResponseMessage responseMessage = ResponseMessage.build(UUID.randomUUID()).code(ResponseStatusCode.SUCCESS).result(resultList).create();
                // http server is sessionless and must handle commit on
                // transactions. the commit occurs
                // before serialization to be consistent with how things
                // work for websocket based
                // communication.  this means that failed serialization
                // does not mean that you won't get
                // a commit to the database
                attemptCommit(requestArguments.getValue3(), graphManager, settings.strictTransactionManagement);
                try {
                    return Unpooled.wrappedBuffer(serializer.getValue1().serializeResponseAsString(responseMessage).getBytes(UTF8));
                } catch (Exception ex) {
                    logger.warn(String.format("Error during serialization for %s", responseMessage), ex);
                    throw ex;
                }
            }));
            evalFuture.exceptionally(t -> {
                if (t.getMessage() != null)
                    sendError(ctx, INTERNAL_SERVER_ERROR, t.getMessage(), Optional.of(t));
                else
                    sendError(ctx, INTERNAL_SERVER_ERROR, String.format("Error encountered evaluating script: %s", requestArguments.getValue0()), Optional.of(t));
                promise.setFailure(t);
                return null;
            });
            evalFuture.thenAcceptAsync(r -> {
                // now that the eval/serialization is done in the same thread - complete
                // the promise so we can
                // write back the HTTP response on the same thread as the original
                // request
                resultHolder.set(r);
                promise.setSuccess();
            }, gremlinExecutor.getExecutorService());
        } catch (Exception ex) {
            // tossed to exceptionCaught which delegates to sendError method
            final Throwable t = ExceptionUtils.getRootCause(ex);
            throw new RuntimeException(null == t ? ex : t);
        }
    }
}
Also used : NOT_FOUND(io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND) Settings(org.apache.tinkerpop.gremlin.server.Settings) Graph(org.apache.tinkerpop.gremlin.structure.Graph) Tokens(org.apache.tinkerpop.gremlin.driver.Tokens) LoggerFactory(org.slf4j.LoggerFactory) Unpooled(io.netty.buffer.Unpooled) Matcher(java.util.regex.Matcher) ChannelPromise(io.netty.channel.ChannelPromise) Map(java.util.Map) METHOD_NOT_ALLOWED(io.netty.handler.codec.http.HttpResponseStatus.METHOD_NOT_ALLOWED) CharsetUtil(io.netty.util.CharsetUtil) HTTP_1_1(io.netty.handler.codec.http.HttpVersion.HTTP_1_1) HttpGremlinEndpointHandler(org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler) POST(io.netty.handler.codec.http.HttpMethod.POST) ObjectNode(org.apache.tinkerpop.shaded.jackson.databind.node.ObjectNode) HttpResponseStatus(io.netty.handler.codec.http.HttpResponseStatus) ArrayNode(org.apache.tinkerpop.shaded.jackson.databind.node.ArrayNode) JsonNode(org.apache.tinkerpop.shaded.jackson.databind.JsonNode) UUID(java.util.UUID) FullHttpRequest(io.netty.handler.codec.http.FullHttpRequest) Collectors(java.util.stream.Collectors) Pair(org.javatuples.Pair) SimpleBindings(javax.script.SimpleBindings) List(java.util.List) Stream(java.util.stream.Stream) ReferenceCountUtil(io.netty.util.ReferenceCountUtil) DefaultFullHttpResponse(io.netty.handler.codec.http.DefaultFullHttpResponse) Timer(com.codahale.metrics.Timer) Optional(java.util.Optional) ResponseStatusCode(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode) CONTENT_TYPE(io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE) Pattern(java.util.regex.Pattern) GremlinExecutor(org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor) ORIGIN(io.netty.handler.codec.http.HttpHeaderNames.ORIGIN) OK(io.netty.handler.codec.http.HttpResponseStatus.OK) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) CONNECTION(io.netty.handler.codec.http.HttpHeaderNames.CONNECTION) ObjectMapper(org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper) CONTENT_LENGTH(io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH) Bindings(javax.script.Bindings) INTERNAL_SERVER_ERROR(io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) AtomicReference(java.util.concurrent.atomic.AtomicReference) BAD_REQUEST(io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST) HashSet(java.util.HashSet) Meter(com.codahale.metrics.Meter) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) MessageSerializer(org.apache.tinkerpop.gremlin.driver.MessageSerializer) ResponseMessage(org.apache.tinkerpop.gremlin.driver.message.ResponseMessage) ByteBuf(io.netty.buffer.ByteBuf) Charset(java.nio.charset.Charset) GraphManager(org.apache.tinkerpop.gremlin.server.GraphManager) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) ChannelFutureListener(io.netty.channel.ChannelFutureListener) MessageTextSerializer(org.apache.tinkerpop.gremlin.driver.ser.MessageTextSerializer) CONTINUE(io.netty.handler.codec.http.HttpResponseStatus.CONTINUE) Logger(org.slf4j.Logger) HttpHeaderValues(io.netty.handler.codec.http.HttpHeaderValues) Iterator(java.util.Iterator) GET(io.netty.handler.codec.http.HttpMethod.GET) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) IOException(java.io.IOException) HEAD(io.netty.handler.codec.http.HttpMethod.HEAD) FunctionUtils(org.apache.tinkerpop.gremlin.util.function.FunctionUtils) Quartet(org.javatuples.Quartet) ACCESS_CONTROL_ALLOW_ORIGIN(io.netty.handler.codec.http.HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN) FullHttpResponse(io.netty.handler.codec.http.FullHttpResponse) QueryStringDecoder(io.netty.handler.codec.http.QueryStringDecoder) ChannelHandler(io.netty.channel.ChannelHandler) TraversalSource(org.apache.tinkerpop.gremlin.process.traversal.TraversalSource) MetricManager(org.apache.tinkerpop.gremlin.server.util.MetricManager) MetricRegistry.name(com.codahale.metrics.MetricRegistry.name) HttpUtil(io.netty.handler.codec.http.HttpUtil) FullHttpRequest(io.netty.handler.codec.http.FullHttpRequest) ChannelPromise(io.netty.channel.ChannelPromise) ByteBuf(io.netty.buffer.ByteBuf) SimpleBindings(javax.script.SimpleBindings) Bindings(javax.script.Bindings) DefaultFullHttpResponse(io.netty.handler.codec.http.DefaultFullHttpResponse) FullHttpResponse(io.netty.handler.codec.http.FullHttpResponse) List(java.util.List) DefaultFullHttpResponse(io.netty.handler.codec.http.DefaultFullHttpResponse) AtomicReference(java.util.concurrent.atomic.AtomicReference) ResponseMessage(org.apache.tinkerpop.gremlin.driver.message.ResponseMessage) IOException(java.io.IOException) MessageTextSerializer(org.apache.tinkerpop.gremlin.driver.ser.MessageTextSerializer) Timer(com.codahale.metrics.Timer) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with GET

use of io.netty.handler.codec.http.HttpMethod.GET in project GraphScope by alibaba.

the class MaxGraphHttpGremlinEndpointHandler method getRequestArguments.

private static Quartet<String, Map<String, Object>, String, Map<String, String>> getRequestArguments(final FullHttpRequest request) {
    if (request.method() == GET || request.method() == HEAD) {
        final QueryStringDecoder decoder = new QueryStringDecoder(request.uri());
        final List<String> gremlinParms = decoder.parameters().get(Tokens.ARGS_GREMLIN);
        if (null == gremlinParms || gremlinParms.size() == 0)
            throw new IllegalArgumentException("no gremlin script supplied");
        final String script = gremlinParms.get(0);
        if (script.isEmpty())
            throw new IllegalArgumentException("no gremlin script supplied");
        // query string parameters - take the first instance of a key only - ignore the rest
        final Map<String, Object> bindings = new HashMap<>();
        decoder.parameters().entrySet().stream().filter(kv -> kv.getKey().startsWith(ARGS_BINDINGS_DOT)).forEach(kv -> bindings.put(kv.getKey().substring(ARGS_BINDINGS_DOT.length()), kv.getValue().get(0)));
        final Map<String, String> aliases = new HashMap<>();
        decoder.parameters().entrySet().stream().filter(kv -> kv.getKey().startsWith(ARGS_ALIASES_DOT)).forEach(kv -> aliases.put(kv.getKey().substring(ARGS_ALIASES_DOT.length()), kv.getValue().get(0)));
        final List<String> languageParms = decoder.parameters().get(Tokens.ARGS_LANGUAGE);
        final String language = (null == languageParms || languageParms.size() == 0) ? null : languageParms.get(0);
        return Quartet.with(script, bindings, language, aliases);
    } else {
        final JsonNode body;
        try {
            body = mapper.readTree(request.content().toString(CharsetUtil.UTF_8));
        } catch (IOException ioe) {
            throw new IllegalArgumentException("body could not be parsed", ioe);
        }
        final JsonNode scriptNode = body.get(Tokens.ARGS_GREMLIN);
        if (null == scriptNode)
            throw new IllegalArgumentException("no gremlin script supplied");
        final JsonNode bindingsNode = body.get(Tokens.ARGS_BINDINGS);
        if (bindingsNode != null && !bindingsNode.isObject())
            throw new IllegalArgumentException("bindings must be a Map");
        final Map<String, Object> bindings = new HashMap<>();
        if (bindingsNode != null)
            bindingsNode.fields().forEachRemaining(kv -> bindings.put(kv.getKey(), kv.getValue()));
        final JsonNode aliasesNode = body.get(Tokens.ARGS_ALIASES);
        if (aliasesNode != null && !aliasesNode.isObject())
            throw new IllegalArgumentException("aliases must be a Map");
        final Map<String, String> aliases = new HashMap<>();
        if (aliasesNode != null)
            aliasesNode.fields().forEachRemaining(kv -> aliases.put(kv.getKey(), kv.getValue().asText()));
        final JsonNode languageNode = body.get(Tokens.ARGS_LANGUAGE);
        final String language = null == languageNode ? null : languageNode.asText();
        return Quartet.with(scriptNode.asText(), bindings, language, aliases);
    }
}
Also used : QueryStringDecoder(io.netty.handler.codec.http.QueryStringDecoder) NOT_FOUND(io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND) Settings(org.apache.tinkerpop.gremlin.server.Settings) Graph(org.apache.tinkerpop.gremlin.structure.Graph) Tokens(org.apache.tinkerpop.gremlin.driver.Tokens) LoggerFactory(org.slf4j.LoggerFactory) Unpooled(io.netty.buffer.Unpooled) Matcher(java.util.regex.Matcher) ChannelPromise(io.netty.channel.ChannelPromise) Map(java.util.Map) METHOD_NOT_ALLOWED(io.netty.handler.codec.http.HttpResponseStatus.METHOD_NOT_ALLOWED) CharsetUtil(io.netty.util.CharsetUtil) HTTP_1_1(io.netty.handler.codec.http.HttpVersion.HTTP_1_1) HttpGremlinEndpointHandler(org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler) POST(io.netty.handler.codec.http.HttpMethod.POST) ObjectNode(org.apache.tinkerpop.shaded.jackson.databind.node.ObjectNode) HttpResponseStatus(io.netty.handler.codec.http.HttpResponseStatus) ArrayNode(org.apache.tinkerpop.shaded.jackson.databind.node.ArrayNode) JsonNode(org.apache.tinkerpop.shaded.jackson.databind.JsonNode) UUID(java.util.UUID) FullHttpRequest(io.netty.handler.codec.http.FullHttpRequest) Collectors(java.util.stream.Collectors) Pair(org.javatuples.Pair) SimpleBindings(javax.script.SimpleBindings) List(java.util.List) Stream(java.util.stream.Stream) ReferenceCountUtil(io.netty.util.ReferenceCountUtil) DefaultFullHttpResponse(io.netty.handler.codec.http.DefaultFullHttpResponse) Timer(com.codahale.metrics.Timer) Optional(java.util.Optional) ResponseStatusCode(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode) CONTENT_TYPE(io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE) Pattern(java.util.regex.Pattern) GremlinExecutor(org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor) ORIGIN(io.netty.handler.codec.http.HttpHeaderNames.ORIGIN) OK(io.netty.handler.codec.http.HttpResponseStatus.OK) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) CONNECTION(io.netty.handler.codec.http.HttpHeaderNames.CONNECTION) ObjectMapper(org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper) CONTENT_LENGTH(io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH) Bindings(javax.script.Bindings) INTERNAL_SERVER_ERROR(io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) AtomicReference(java.util.concurrent.atomic.AtomicReference) BAD_REQUEST(io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST) HashSet(java.util.HashSet) Meter(com.codahale.metrics.Meter) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) MessageSerializer(org.apache.tinkerpop.gremlin.driver.MessageSerializer) ResponseMessage(org.apache.tinkerpop.gremlin.driver.message.ResponseMessage) ByteBuf(io.netty.buffer.ByteBuf) Charset(java.nio.charset.Charset) GraphManager(org.apache.tinkerpop.gremlin.server.GraphManager) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) ChannelFutureListener(io.netty.channel.ChannelFutureListener) MessageTextSerializer(org.apache.tinkerpop.gremlin.driver.ser.MessageTextSerializer) CONTINUE(io.netty.handler.codec.http.HttpResponseStatus.CONTINUE) Logger(org.slf4j.Logger) HttpHeaderValues(io.netty.handler.codec.http.HttpHeaderValues) Iterator(java.util.Iterator) GET(io.netty.handler.codec.http.HttpMethod.GET) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) IOException(java.io.IOException) HEAD(io.netty.handler.codec.http.HttpMethod.HEAD) FunctionUtils(org.apache.tinkerpop.gremlin.util.function.FunctionUtils) Quartet(org.javatuples.Quartet) ACCESS_CONTROL_ALLOW_ORIGIN(io.netty.handler.codec.http.HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN) FullHttpResponse(io.netty.handler.codec.http.FullHttpResponse) QueryStringDecoder(io.netty.handler.codec.http.QueryStringDecoder) ChannelHandler(io.netty.channel.ChannelHandler) TraversalSource(org.apache.tinkerpop.gremlin.process.traversal.TraversalSource) MetricManager(org.apache.tinkerpop.gremlin.server.util.MetricManager) MetricRegistry.name(com.codahale.metrics.MetricRegistry.name) HttpUtil(io.netty.handler.codec.http.HttpUtil) HashMap(java.util.HashMap) JsonNode(org.apache.tinkerpop.shaded.jackson.databind.JsonNode) IOException(java.io.IOException)

Aggregations

Meter (com.codahale.metrics.Meter)2 MetricRegistry.name (com.codahale.metrics.MetricRegistry.name)2 Timer (com.codahale.metrics.Timer)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)2 ByteBuf (io.netty.buffer.ByteBuf)2 Unpooled (io.netty.buffer.Unpooled)2 ChannelFutureListener (io.netty.channel.ChannelFutureListener)2 ChannelHandler (io.netty.channel.ChannelHandler)2 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)2 ChannelPromise (io.netty.channel.ChannelPromise)2 DefaultFullHttpResponse (io.netty.handler.codec.http.DefaultFullHttpResponse)2 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)2 FullHttpResponse (io.netty.handler.codec.http.FullHttpResponse)2 ACCESS_CONTROL_ALLOW_ORIGIN (io.netty.handler.codec.http.HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN)2 CONNECTION (io.netty.handler.codec.http.HttpHeaderNames.CONNECTION)2 CONTENT_LENGTH (io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH)2 CONTENT_TYPE (io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE)2 ORIGIN (io.netty.handler.codec.http.HttpHeaderNames.ORIGIN)2 HttpHeaderValues (io.netty.handler.codec.http.HttpHeaderValues)2 GET (io.netty.handler.codec.http.HttpMethod.GET)2