Class Context
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.server.Context
 
- 
- Direct Known Subclasses:
- SessionTask
 
 public class Context extends Object The context of Gremlin Server within which a particular request is made.- Author:
- Stephen Mallette (http://stephen.genoprime.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classContext.RequestContentTypeThe type of the request as determined by the contents ofTokens.ARGS_GREMLIN.
 - 
Constructor SummaryConstructors Constructor Description Context(RequestMessage requestMessage, io.netty.channel.ChannelHandlerContext ctx, Settings settings, GraphManager graphManager, GremlinExecutor gremlinExecutor, ScheduledExecutorService scheduledExecutorService)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()Flushes messages to the underlying transport.io.netty.channel.ChannelHandlerContextgetChannelHandlerContext()Gets the Netty context.GraphManagergetGraphManager()Gets the set ofGraphobjects configured in Gremlin Server.ObjectgetGremlinArgument()GremlinExecutorgetGremlinExecutor()Gets the executor chosen to evaluate incoming Gremlin scripts based on the request.StringgetMaterializeProperties()Context.RequestContentTypegetRequestContentType()RequestMessagegetRequestMessage()Gets the current request to Gremlin Server.longgetRequestTimeout()The timeout for the request.ScheduledExecutorServicegetScheduledExecutorService()SettingsgetSettings()Gets the current configuration of Gremlin Server.booleangetStartedResponse()Gets whether the server has started processing the response for this request.ScheduledFuture<?>getTimeoutExecutor()StringgetUserAgent()Returns the user agent (if any) which was sent from the client during the web socket handshake.voidhandleDetachment(List<Object> aggregate)booleanisFinalResponseWritten()voidsendTimeoutResponse()Writes a default timeout error response message to the underlying channel.voidsendTimeoutResponse(String message)Writes a specific timeout error response message to the underlying channel.voidsetStartedResponse()Signal that the server has started processing the response.voidsetTimeoutExecutor(ScheduledFuture<?> timeoutExecutor)voidwrite(ResponseMessage message)voidwrite(ResponseStatusCode code, Object responseMessage)voidwriteAndFlush(ResponseMessage message)Writes a response message to the underlying channel while ensuring that at most onefinalresponse is written.voidwriteAndFlush(ResponseStatusCode code, Object responseMessage)Writes a response message to the underlying channel while ensuring that at most onefinalresponse is written.
 
- 
- 
- 
Constructor Detail- 
Contextpublic Context(RequestMessage requestMessage, io.netty.channel.ChannelHandlerContext ctx, Settings settings, GraphManager graphManager, GremlinExecutor gremlinExecutor, ScheduledExecutorService scheduledExecutorService) 
 
- 
 - 
Method Detail- 
setTimeoutExecutorpublic void setTimeoutExecutor(ScheduledFuture<?> timeoutExecutor) 
 - 
getTimeoutExecutorpublic ScheduledFuture<?> getTimeoutExecutor() 
 - 
getRequestTimeoutpublic long getRequestTimeout() The timeout for the request. If the request is a script it examines the script for a timeout setting usingwith(). If that is not found then it examines the request itself to see if the timeout is provided byTokens.ARGS_EVAL_TIMEOUT. If that is not provided then theSettings.evaluationTimeoutis utilized as the default.
 - 
getMaterializePropertiespublic String getMaterializeProperties() 
 - 
isFinalResponseWrittenpublic boolean isFinalResponseWritten() 
 - 
getRequestContentTypepublic Context.RequestContentType getRequestContentType() 
 - 
getGremlinArgumentpublic Object getGremlinArgument() 
 - 
getScheduledExecutorServicepublic ScheduledExecutorService getScheduledExecutorService() 
 - 
getRequestMessagepublic RequestMessage getRequestMessage() Gets the current request to Gremlin Server.
 - 
getChannelHandlerContextpublic io.netty.channel.ChannelHandlerContext getChannelHandlerContext() Gets the Netty context.
 - 
getSettingspublic Settings getSettings() Gets the current configuration of Gremlin Server.
 - 
getGraphManagerpublic GraphManager getGraphManager() Gets the set ofGraphobjects configured in Gremlin Server.
 - 
getGremlinExecutorpublic GremlinExecutor getGremlinExecutor() Gets the executor chosen to evaluate incoming Gremlin scripts based on the request.
 - 
getUserAgentpublic String getUserAgent() Returns the user agent (if any) which was sent from the client during the web socket handshake. Returns empty string if no user agent exists
 - 
getStartedResponsepublic boolean getStartedResponse() Gets whether the server has started processing the response for this request.
 - 
setStartedResponsepublic void setStartedResponse() Signal that the server has started processing the response.
 - 
sendTimeoutResponsepublic void sendTimeoutResponse() Writes a default timeout error response message to the underlying channel.
 - 
sendTimeoutResponsepublic void sendTimeoutResponse(String message) Writes a specific timeout error response message to the underlying channel.
 - 
writeAndFlushpublic void writeAndFlush(ResponseMessage message) Writes a response message to the underlying channel while ensuring that at most onefinalresponse 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. 
 - 
writeAndFlushpublic void writeAndFlush(ResponseStatusCode code, Object responseMessage) Writes a response message to the underlying channel while ensuring that at most onefinalresponse 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. - See Also:
- writeAndFlush(ResponseMessage)
 
 - 
writepublic void write(ResponseMessage message) 
 - 
writepublic void write(ResponseStatusCode code, Object responseMessage) 
 - 
flushpublic void flush() Flushes messages to the underlying transport.
 
- 
 
-