use of org.apache.jena.fuseki.server.DataAccessPointRegistry in project jena by apache.
the class FusekiFilter method doFilter.
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
// Handle context path
String uri = ActionLib.actionURI(req);
String datasetUri = ActionLib.mapActionRequestToDataset(uri);
DataAccessPointRegistry registry = DataAccessPointRegistry.get(request.getServletContext());
if (LogFilter) {
log.info("Filter: Request URI = " + req.getRequestURI());
log.info("Filter: Action URI = " + uri);
log.info("Filter: Dataset URI = " + datasetUri);
}
if (datasetUri != null) {
if (registry.isRegistered(datasetUri)) {
if (LogFilter)
log.info("Filter: dispatch");
überServlet.doCommon(req, resp);
return;
}
// not rely on the überServlet.
if (Fuseki.GSP_DIRECT_NAMING) {
// Not a dataset name ; may be a direct GSP direct name that does not look like a service name.
for (String dsKey : registry.keys()) {
DataAccessPoint dap = registry.get(dsKey);
String dsName = dap.getName();
if (datasetUri.startsWith(dsName)) {
if (LogFilter)
log.info("Filter: dispatch (GSP direct name)");
überServlet.doCommon(req, resp);
return;
}
}
}
}
} catch (Exception ex) {
}
if (LogFilter)
log.info("Filter: pass to chain");
// Not found - continue.
chain.doFilter(request, response);
}
use of org.apache.jena.fuseki.server.DataAccessPointRegistry in project jena by apache.
the class TestEmbeddedFuseki method embedded_02.
// Different dataset name.
@Test
public void embedded_02() {
DatasetGraph dsg = dataset();
//FusekiEnv.choosePort() ;
int port = 0;
FusekiEmbeddedServer server = FusekiEmbeddedServer.make(port, "/ds2", dsg);
DataAccessPointRegistry registry = server.getDataAccessPointRegistry();
// But no /ds
assertEquals(1, registry.size());
assertTrue(registry.isRegistered("/ds2"));
assertFalse(registry.isRegistered("/ds"));
try {
server.start();
} finally {
server.stop();
}
}
Aggregations