Zen 98052
2016-06-09 19:01:29 UTC
Hi,
I implement our own Sparql endpoint service, and I am trying to pass the session id (unique per each client request), so that it can be accessed from the code in OpExecutor implementation.
I store the session id in my graph object, the code looks something like:
MyGraph graph = createGraph(appContext); // appContext contains session id and other application state
Model graphModel = ModelFactory.createModelForGraph(graph);
Then inside the class MyOpExecutor (extends Jena's OpExecutor class), I tried to access the session id thru this way:
protected QueryIterator execute(OpBGP opBGP, QueryIterator input) {\
if (this.execCxt.getActiveGraph() instanceof MyGraph) {
MyGraph g = (MyGraph)this.execCxt.getActiveGraph();
// get the session id which can be passed to logging
String sid = g.getAppContext().getSessionId();
...
}
}
The problem I am having is the sid will be always the same sid (from the first client request), though I create a new MyGraph object for each request.
Do you know how to pass the current graph, so that getActiveGraph() code above will get correct graph (for that session) instead of the graph from first client request?
Thanks,
Z
I implement our own Sparql endpoint service, and I am trying to pass the session id (unique per each client request), so that it can be accessed from the code in OpExecutor implementation.
I store the session id in my graph object, the code looks something like:
MyGraph graph = createGraph(appContext); // appContext contains session id and other application state
Model graphModel = ModelFactory.createModelForGraph(graph);
Then inside the class MyOpExecutor (extends Jena's OpExecutor class), I tried to access the session id thru this way:
protected QueryIterator execute(OpBGP opBGP, QueryIterator input) {\
if (this.execCxt.getActiveGraph() instanceof MyGraph) {
MyGraph g = (MyGraph)this.execCxt.getActiveGraph();
// get the session id which can be passed to logging
String sid = g.getAppContext().getSessionId();
...
}
}
The problem I am having is the sid will be always the same sid (from the first client request), though I create a new MyGraph object for each request.
Do you know how to pass the current graph, so that getActiveGraph() code above will get correct graph (for that session) instead of the graph from first client request?
Thanks,
Z