[MOBY-guts] biomoby commit

Gary Schlitz gss at pub.open-bio.org
Thu Nov 4 22:34:32 UTC 2004


gss
Thu Nov  4 17:34:32 EST 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/servlets
In directory pub.open-bio.org:/tmp/cvs-serv32142/src/org/smoby/ref/servlets

Modified Files:
	ProviderInvestigationServlet.java 
Log Message:
Misc

moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/servlets ProviderInvestigationServlet.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/servlets/ProviderInvestigationServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/servlets/ProviderInvestigationServlet.java	2004/07/15 20:27:17	1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/servlets/ProviderInvestigationServlet.java	2004/11/04 22:34:32	1.2
@@ -5,17 +5,19 @@
 import javax.servlet.*;
 import javax.servlet.http.*;
 import org.apache.commons.logging.*;
-import org.smoby.ref.tools.db.*;
 import org.smoby.graph.*;
 import org.smoby.ref.tools.*;
+import org.smoby.ref.tools.db.*;
 import org.smoby.servlet.*;
 
 /**
- * This servlet class is used to request that S-MOBY investigate a URL for the
- * possibility of its having a provider description graph. It responds to both
- * GET and POST requests, and expects a "provider-url" parameter to be sent.
- * The only feedback given is that if the provider-url is missing, the response
- * status is set to 406 NOT ACCEPTABLE; otherwise, the status is set to 200 OK.
+ * This servlet class is used to request that S-MOBY investigate
+ * a URL for the possibility of its having a provider description
+ * graph. It responds to both GET and POST requests, and expects a
+ * "provider-url" parameter to be sent. The only feedback given is
+ * that if the provider-url is missing, the response status is set
+ * to 406 NOT ACCEPTABLE; otherwise, the status is set to 200 OK,
+ * and a generic thank you message is returned.
  */
 public class ProviderInvestigationServlet extends BaseServlet
 {
@@ -24,15 +26,17 @@
     /**
      * Respond to an HTTP GET message
      */
-    public void doGet(HttpServletRequest request, HttpServletResponse response)
+    public void doGet(HttpServletRequest request,
+    		          HttpServletResponse response)
         throws ServletException, IOException
     {
         try
         {
-            // Get the provider-url parameter, and call the static investigate()
-            // method on the ProviderInvestigator class to do the actual
-            // investigation of the URL. No response is explicitly returned (a
-            // 200 OK status is automatically returned).
+            // Get the provider-url parameter, and call the static
+        	// investigate() method on the ProviderInvestigator class
+        	// to do the actual investigation of the URL. No response
+        	// is explicitly returned (a 200 OK status is automatically
+        	// returned).
             //
             String providerURL = ParamReader.getParameter("provider-url", request);
             URIInvestigator.investigate(providerURL);
@@ -43,28 +47,35 @@
             // The provider URL is missing
             //
             syncLog.error("GET without provider-url parameter");
-            response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE, e.getMessage());
+            response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
+            		           e.getMessage());
         }
     }
     
     /**
      * Handle an HTTP POST message in the same way an HTTP GET is handled.
      */
-    public void doPost(HttpServletRequest request, HttpServletResponse response)
+    public void doPost(HttpServletRequest request,
+    		           HttpServletResponse response)
         throws ServletException, IOException
     {
     	doGet(request, response);
     }
     
-    private void acknowledgeSuggestion(String url, HttpServletResponse response)
+    /**
+     * Provide a generic "thank you for your suggestion" response,
+     * regardless of the outcome of the investigation.
+     */
+    private void acknowledgeSuggestion(String url,
+    		                           HttpServletResponse response)
         throws IOException
     {
     	response.setContentType("text/html");
-        PrintWriter out = response.getWriter();
-        out.println("<HTML>");
+        PrintStream out = new PrintStream(response.getOutputStream());
+        startHTML(response, "Thanks for the suggestion", out);
         out.println("Thank you.<p>Your suggestion to look at ");
         out.println("<a href=\"" + url + "\">" + url + "</a>");
         out.println(" has been noted.");
-        out.println("</HTML>");
+        finishHTML(out);
     }
 }
\ No newline at end of file




More information about the MOBY-guts mailing list