35 |
import java.net.*; |
import java.net.*; |
36 |
import java.util.Iterator; |
import java.util.Iterator; |
37 |
|
|
38 |
/** An HTTP server serving blocks from a Storm pool. |
/** An HTTP server serving blocks from a Storm pool. When started from command |
39 |
|
* line, it servers the directory given as first argument. |
40 |
*/ |
*/ |
41 |
public class HTTPProxy implements Runnable { |
public class HTTPProxy implements Runnable { |
42 |
public static boolean dbg = false; |
public static boolean dbg = false; |
112 |
|
|
113 |
BlockId id = new BlockId(uri); |
BlockId id = new BlockId(uri); |
114 |
Block block = pool.get(id); |
Block block = pool.get(id); |
115 |
if(dbg) p("<"+port+"> Serve: "+id); |
if(HTTPProxy.dbg) p("<"+port+"> Serve: "+id); |
116 |
HTTPResponse resp = resf.makeResponse(200, "Ok"); |
HTTPResponse resp = resf.makeResponse(200, "Ok"); |
117 |
resp.setField("Content-Type", id.getContentType()); |
resp.setField("Content-Type", id.getContentType()); |
118 |
if(!rewrite || !id.getContentType().equals("text/html")) { |
if(!rewrite || !id.getContentType().equals("text/html")) { |