1 31 32 package org.apache.commons.httpclient.server; 33 34 import java.io.IOException ; 35 36 import org.apache.commons.httpclient.Credentials; 37 38 43 public class SimpleProxy extends SimpleHttpServer { 44 private HttpRequestHandlerChain chain = new SimpleChain(); 45 46 49 public SimpleProxy() throws IOException { 50 setRequestHandler(chain); 51 } 52 53 58 public SimpleProxy(int port) throws IOException { 59 super(port); 60 } 61 62 public void requireCredentials(Credentials creds) { 63 chain.prependHandler(new ProxyAuthRequestHandler(creds)); 64 } 65 66 private class SimpleChain extends HttpRequestHandlerChain { 67 public SimpleChain() { 68 appendHandler(new TransparentProxyRequestHandler()); 69 appendHandler(new ProxyRequestHandler()); 70 } 71 } 72 73 74 } 75 | Popular Tags |