1 package org.objectweb.celtix.bus.transports.http.protocol.pipe; 2 3 import java.io.IOException ; 4 import java.io.InputStream ; 5 import java.net.URL ; 6 import java.net.URLConnection ; 7 import java.util.List ; 8 import java.util.Map ; 9 import java.util.concurrent.ConcurrentHashMap ; 10 11 public final class PipeServer { 12 static final Map <String , PipeHTTPServerTransport> SERVERS 13 = new ConcurrentHashMap <String , PipeHTTPServerTransport>(); 14 15 private PipeServer() { 16 } 18 19 public static PipeResponse startDispatch(URL url, URLConnection connection, 20 InputStream in, 21 Map <String , List <String >> requestHeaders) 22 throws IOException { 23 24 PipeResponse resp = new PipeResponse(connection, in, requestHeaders); 25 26 PipeHTTPServerTransport trans = SERVERS.get(url.getPath()); 27 if (trans == null) { 28 throw new IOException ("Could not connect to " + url.getPath()); 29 } 30 trans.doService(resp); 31 return resp; 32 } 33 34 } 35 | Popular Tags |