public class Context extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Context.RequestContentType
The type of the request as determined by the contents of
Tokens.ARGS_GREMLIN . |
Constructor and Description |
---|
Context(RequestMessage requestMessage,
io.netty.channel.ChannelHandlerContext ctx,
Settings settings,
GraphManager graphManager,
GremlinExecutor gremlinExecutor,
ScheduledExecutorService scheduledExecutorService) |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flushes messages to the underlying transport.
|
io.netty.channel.ChannelHandlerContext |
getChannelHandlerContext()
Gets the Netty context.
|
GraphManager |
getGraphManager()
Gets the set of
Graph objects configured in Gremlin Server. |
Object |
getGremlinArgument() |
GremlinExecutor |
getGremlinExecutor()
Gets the executor chosen to evaluate incoming Gremlin scripts based on the request.
|
Context.RequestContentType |
getRequestContentType() |
RequestMessage |
getRequestMessage()
Gets the current request to Gremlin Server.
|
long |
getRequestTimeout()
The timeout for the request.
|
ScheduledExecutorService |
getScheduledExecutorService() |
Settings |
getSettings()
Gets the current configuration of Gremlin Server.
|
boolean |
getStartedResponse()
Gets whether the server has started processing the response for this request.
|
ScheduledFuture<?> |
getTimeoutExecutor() |
String |
getUserAgent()
Returns the user agent (if any) which was sent from the client during the web socket handshake.
|
boolean |
isFinalResponseWritten() |
void |
sendTimeoutResponse()
Writes a default timeout error response message to the underlying channel.
|
void |
sendTimeoutResponse(String message)
Writes a specific timeout error response message to the underlying channel.
|
void |
setStartedResponse()
Signal that the server has started processing the response.
|
void |
setTimeoutExecutor(ScheduledFuture<?> timeoutExecutor) |
void |
write(ResponseMessage message) |
void |
write(ResponseStatusCode code,
Object responseMessage) |
void |
writeAndFlush(ResponseMessage message)
Writes a response message to the underlying channel while ensuring that at most one
final response is written. |
void |
writeAndFlush(ResponseStatusCode code,
Object responseMessage)
Writes a response message to the underlying channel while ensuring that at most one
final response is written. |
public Context(RequestMessage requestMessage, io.netty.channel.ChannelHandlerContext ctx, Settings settings, GraphManager graphManager, GremlinExecutor gremlinExecutor, ScheduledExecutorService scheduledExecutorService)
public void setTimeoutExecutor(ScheduledFuture<?> timeoutExecutor)
public ScheduledFuture<?> getTimeoutExecutor()
public long getRequestTimeout()
with()
. If that is not found then it examines the request itself to see if the timeout is provided by
Tokens.ARGS_EVAL_TIMEOUT
. If that is not provided then the Settings.evaluationTimeout
is
utilized as the default.public boolean isFinalResponseWritten()
public Context.RequestContentType getRequestContentType()
public Object getGremlinArgument()
public ScheduledExecutorService getScheduledExecutorService()
public RequestMessage getRequestMessage()
public io.netty.channel.ChannelHandlerContext getChannelHandlerContext()
public Settings getSettings()
public GraphManager getGraphManager()
Graph
objects configured in Gremlin Server.public GremlinExecutor getGremlinExecutor()
public String getUserAgent()
public boolean getStartedResponse()
public void setStartedResponse()
public void sendTimeoutResponse()
public void sendTimeoutResponse(String message)
public void writeAndFlush(ResponseMessage message)
final
response is written.
Note: this method should be used instead of writing to the channel directly when multiple threads are expected to produce response messages concurrently.
Attempts to write more than one final response message will be ignored.
public void writeAndFlush(ResponseStatusCode code, Object responseMessage)
final
response is written.
The caller must make sure that the provided response status code matches the content of the message.
Note: this method should be used instead of writing to the channel directly when multiple threads are expected to produce response messages concurrently.
Attempts to write more than one final response message will be ignored.
writeAndFlush(ResponseMessage)
public void write(ResponseMessage message)
public void write(ResponseStatusCode code, Object responseMessage)
public void flush()
Copyright © 2013–2023 Apache Software Foundation. All rights reserved.