use of javax.servlet.http.HttpServlet in project jena by apache.
the class SPARQLServer method configureOneDataset.
private void configureOneDataset(ServletContextHandler context, DatasetRef dsDesc, boolean enableCompression) {
String datasetPath = dsDesc.name;
if (datasetPath.equals("/"))
datasetPath = "";
else if (!datasetPath.startsWith("/"))
datasetPath = "/" + datasetPath;
if (datasetPath.endsWith("/"))
datasetPath = datasetPath.substring(0, datasetPath.length() - 1);
dsDesc.init();
if (DatasetRegistry.get().isRegistered(datasetPath))
throw new FusekiException("Already registered: " + datasetPath);
DatasetRegistry.get().put(datasetPath, dsDesc);
serverLog.info(format("Dataset path = %s", datasetPath));
HttpServlet sparqlQuery = new SPARQL_QueryDataset();
HttpServlet sparqlUpdate = new SPARQL_Update();
HttpServlet sparqlUpload = new SPARQL_Upload();
HttpServlet sparqlHttpR = new SPARQL_REST_R();
HttpServlet sparqlHttpRW = new SPARQL_REST_RW();
HttpServlet sparqlDataset = new SPARQL_UberServlet.AccessByConfig();
if (!überServlet) {
// If uberserver, these are unnecessary but can be used.
// If just means the überservlet isn't handling these operations.
addServlet(context, datasetPath, sparqlQuery, dsDesc.query, enableCompression);
addServlet(context, datasetPath, sparqlUpdate, dsDesc.update, false);
// No point - no results of any size.
addServlet(context, datasetPath, sparqlUpload, dsDesc.upload, false);
addServlet(context, datasetPath, sparqlHttpR, dsDesc.readGraphStore, enableCompression);
addServlet(context, datasetPath, sparqlHttpRW, dsDesc.readWriteGraphStore, enableCompression);
// This adds direct operations on the dataset itself.
// addServlet(context, datasetPath, sparqlDataset,
// ListOfEmptyString, enableCompression) ;
} else {
// This is the servlet that analyses requests and dispatches them to
// the appropriate servlet.
// SPARQL Query, SPARQL Update -- handles dataset?query=
// dataset?update=
// Graph Store Protocol (direct and indirect naming) if enabled.
// GET/PUT/POST on the dataset itself.
// It also checks for a request that looks like a service request
// and passes it
// on to the service (this takes precedence over direct naming).
addServlet(context, datasetPath, sparqlDataset, epDataset, enableCompression);
}
// Add JMX beans to record daatset and it's services.
addJMX(dsDesc);
}
use of javax.servlet.http.HttpServlet in project tomcat by apache.
the class TestExpiresFilter method testSkipBecauseExpiresIsDefined.
@Test
public void testSkipBecauseExpiresIsDefined() throws Exception {
HttpServlet servlet = new HttpServlet() {
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/xml; charset=utf-8");
response.addDateHeader("Expires", System.currentTimeMillis());
response.getWriter().print("Hello world");
}
};
validate(servlet, null);
}
use of javax.servlet.http.HttpServlet in project tomcat by apache.
the class TestExpiresFilter method testUseDefaultConfiguration2.
@Test
public void testUseDefaultConfiguration2() throws Exception {
HttpServlet servlet = new HttpServlet() {
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("image/jpeg");
response.addHeader("Cache-Control", "private");
response.getWriter().print("Hello world");
}
};
validate(servlet, Integer.valueOf(1 * 60));
}
use of javax.servlet.http.HttpServlet in project tomcat by apache.
the class TestExpiresFilter method testNullContentType.
@Test
public void testNullContentType() throws Exception {
HttpServlet servlet = new HttpServlet() {
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(null);
}
};
validate(servlet, Integer.valueOf(1 * 60));
}
use of javax.servlet.http.HttpServlet in project tomcat by apache.
the class TestExpiresFilter method testSkipBecauseCacheControlMaxAgeIsDefined.
@Test
public void testSkipBecauseCacheControlMaxAgeIsDefined() throws Exception {
HttpServlet servlet = new HttpServlet() {
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/xml; charset=utf-8");
response.addHeader("Cache-Control", "private, max-age=232");
response.getWriter().print("Hello world");
}
};
validate(servlet, Integer.valueOf(232));
}
Aggregations