Restored ProxyServer class to be used as a proxy for browsers.
This commit is contained in:
parent
d7572f5251
commit
56cf2c2d3d
|
@ -20,7 +20,7 @@ package org.eclipse.jetty.servlets;
|
|||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.ConnectHandler;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
|
||||
|
@ -30,26 +30,22 @@ public class ProxyServer
|
|||
{
|
||||
Server server = new Server();
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
connector.setPort(8080);
|
||||
connector.setPort(8888);
|
||||
server.addConnector(connector);
|
||||
|
||||
HandlerCollection handlers = new HandlerCollection();
|
||||
server.setHandler(handlers);
|
||||
// Setup proxy handler to handle CONNECT methods
|
||||
ConnectHandler proxy = new ConnectHandler();
|
||||
// proxy.setWhite(new String[]{"mail.google.com"});
|
||||
// proxy.addWhitelistHost("www.google.com");
|
||||
server.setHandler(proxy);
|
||||
|
||||
// Setup proxy servlet
|
||||
ServletContextHandler context = new ServletContextHandler(handlers, "/", ServletContextHandler.SESSIONS);
|
||||
ServletContextHandler context = new ServletContextHandler(proxy, "/", ServletContextHandler.SESSIONS);
|
||||
ServletHolder proxyServlet = new ServletHolder(ProxyServlet.class);
|
||||
// proxyServlet.setInitParameter("whiteList", "google.com, www.eclipse.org, localhost");
|
||||
// proxyServlet.setInitParameter("blackList", "google.com/calendar/*, www.eclipse.org/committers/");
|
||||
context.addServlet(proxyServlet, "/*");
|
||||
|
||||
|
||||
// Setup proxy handler to handle CONNECT methods
|
||||
// ConnectHandler proxy = new ConnectHandler();
|
||||
// proxy.setWhite(new String[]{"mail.google.com"});
|
||||
// proxy.addWhitelistHost("www.google.com");
|
||||
// handlers.addHandler(proxy);
|
||||
|
||||
server.start();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue