[Mulgara-svn] r1478 - trunk/src/jar/querylang/java/org/mulgara/protocol/http

pag at mulgara.org pag at mulgara.org
Sat Feb 7 02:19:40 UTC 2009


Author: pag
Date: 2009-02-06 18:19:39 -0800 (Fri, 06 Feb 2009)
New Revision: 1478

Added:
   trunk/src/jar/querylang/java/org/mulgara/protocol/http/PublicSparqlServlet.java
Log:
New servlet for query-only SPARQL operation. Necessary for public access.

Added: trunk/src/jar/querylang/java/org/mulgara/protocol/http/PublicSparqlServlet.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/protocol/http/PublicSparqlServlet.java	                        (rev 0)
+++ trunk/src/jar/querylang/java/org/mulgara/protocol/http/PublicSparqlServlet.java	2009-02-07 02:19:39 UTC (rev 1478)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 Fedora Commons, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.mulgara.protocol.http;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mulgara.server.SessionFactoryProvider;
+import static javax.servlet.http.HttpServletResponse.SC_METHOD_NOT_ALLOWED;
+
+/**
+ * A publicly facing endpoint for SPARQL. The private one permits write commands
+ * via POST and GET.
+ *
+ * @created Feb 5, 2009
+ * @author Paul Gearon
+ */
+public class PublicSparqlServlet extends SparqlServlet {
+
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Creates the servlet for communicating with the given server.
+   * @param server The server that provides access to the database.
+   * @throws IOException If configuring network writers fails.
+   */
+  public PublicSparqlServlet(SessionFactoryProvider server) throws IOException {
+    super(server);
+  }
+
+  /**
+   * Respond to a request for the servlet. This may handle update queries.
+   * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+   */
+  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+    resp.sendError(SC_METHOD_NOT_ALLOWED, "This is a Read Only service.");
+  }
+
+  /**
+   * Respond to a request for the servlet. This may handle update queries.
+   * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+   */
+  protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+    resp.sendError(SC_METHOD_NOT_ALLOWED, "This is a Read Only service.");
+  }
+
+
+
+}




More information about the Mulgara-svn mailing list