diff options
| author | Zsolt Kovcs <zs.myth@gmail.com> | 2014-09-23 12:11:08 +0200 |
|---|---|---|
| committer | Zsolt Kovcs <zs.myth@gmail.com> | 2014-09-23 12:11:08 +0200 |
| commit | 56fe4494620ac2e7831875733d7ad2ffc1c6b73f (patch) | |
| tree | 0b55fbc86136f672ba06a4bb1e46182651e533c1 /src/main/java/com/c2kernel/process | |
| parent | f9ae5103d960a3c599a0490003fcb591fcf1b4ce (diff) | |
Removing HTTP and UDP servers
Diffstat (limited to 'src/main/java/com/c2kernel/process')
| -rw-r--r-- | src/main/java/com/c2kernel/process/ItemHTTPBridge.java | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/main/java/com/c2kernel/process/ItemHTTPBridge.java b/src/main/java/com/c2kernel/process/ItemHTTPBridge.java deleted file mode 100644 index 8db52f9..0000000 --- a/src/main/java/com/c2kernel/process/ItemHTTPBridge.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.c2kernel.process;
-
-import java.util.StringTokenizer;
-
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.InvalidItemPathException;
-import com.c2kernel.lookup.ItemPath;
-import com.c2kernel.utils.server.HTTPRequestHandler;
-
-/* QueryData over HTTP Socket Handler
- * Processes an HTTP request consisting of /<path to item>/<path to kernel object>
- * and returns that kernel object as XML
- * Currently supports GET requests.
- * REVISIT: POST calls Item.request()
- */
-
-public class ItemHTTPBridge extends HTTPRequestHandler {
-
- public ItemHTTPBridge() { }
-
- @Override
- public String getName() {
- return "Item HTTP Server";
- }
-
- @Override
- public String processRequest() {
- System.out.println("ItemHTTPBridge::ProcessRequest()");
- StringTokenizer tok = new StringTokenizer(resource, "?");
- String path = tok.nextToken();
- String query = tok.nextToken();
- ItemPath itemPath;
- try {
- itemPath = new ItemPath(path);
- } catch (InvalidItemPathException ex) {
- DomainPath domPath = new DomainPath(path);
- if (!domPath.exists())
- return error("404 Not Found", "The path "+path+" you requested was not found.");
- try {
- itemPath = domPath.getItemPath();
- } catch (ObjectNotFoundException e) {
- return error("404 Not Found", "The path "+path+" you requested was not found.");
- }
- }
-
- if (method.equals("GET")) {
- try {
- C2KLocalObject response = Gateway.getStorage().get(itemPath, query, null);
- return Gateway.getMarshaller().marshall(response);
- }
- catch (Exception e) {
- return error("400 Bad Request", "Usage: GET <path to item>?<path to kernel object><br>"+e.getClass().getName());
- }
- }
- return(super.processRequest());
- }
-
-}
|
