Author: paperwing
Date: 2012-05-07 15:37:40 -0700 (Mon, 07 May 2012)
New Revision: 29141
Added:
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalGetResponder.java
Modified:
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
Log:
Started GetResponder class to be used for responding to HTTP requests, started
simple method for parsing encoded URL requests containing parameters in the
form <base_url>?key1=value1&key2=value2&key3=value3... (known as the
application/x-www-form-urlencoded form) in case development on web store will
need this feature in the near future
Added:
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalGetResponder.java
===================================================================
---
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalGetResponder.java
(rev 0)
+++
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalGetResponder.java
2012-05-07 22:37:40 UTC (rev 29141)
@@ -0,0 +1,48 @@
+package org.cytoscape.app.internal.net.server;
+
+import java.util.Map;
+
+import org.cytoscape.app.internal.net.server.LocalHttpServer.Response;
+
+/**
+ * This class is responsible for handling GET requests received by the local
HTTP server.
+ */
+public class LocalGetResponder implements LocalHttpServer.GetResponder{
+
+ private static final String STATUS_QUERY_URL = "status";
+ private static final String STATUS_QUERY_APP_NAME = "appname";
+
+ private static final String INSTALL_QUERY_URL = "install";
+ private static final String INSTALL_QUERY_APP_NAME = "appname";
+
+
+ @Override
+ public boolean canRespondTo(String url) throws Exception {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Response respond(String url) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ /**
+ * Parses the parameters from an URL encoded in the
application/x-www-form-urlencoded form,
+ * which is the default form. This method uses a simple parsing method,
only scanning text after the last '?' symbol
+ * and splitting with the '=' symbol. A more comprehensive (and
possibly securer) parser can be found in the URLEncodedUtils
+ * class of the Apache HttpClient library.
+ *
+ * @param url
+ * @return
+ */
+ private Map<String, String> parseEncodedUrl(String url) {
+ int lastIndex = url.lastIndexOf("?");
+
+ String paramSubstring = url.substring(lastIndex);
+
+ return null;
+ }
+}
Property changes on:
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalGetResponder.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
===================================================================
---
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
2012-05-07 22:19:00 UTC (rev 29140)
+++
csplugins/trunk/toronto/yuedong/app_manager/impl/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
2012-05-07 22:37:40 UTC (rev 29141)
@@ -248,7 +248,7 @@
final String method =
request.getRequestLine().getMethod().toLowerCase();
System.out.println("Request received. Method: " + method);
-
+
// loop thru responders and see if any of them produce a
response
Response response = null;
if (method.equals("get") || method.equals("head")) {
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.