Skip to content

Commit

Permalink
Initial rough pass at Netty 4 upgrade - main code compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Aug 7, 2013
1 parent fa30985 commit abf6ac0
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 843 deletions.
4 changes: 3 additions & 1 deletion Netty_4_Upgrade_Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ Relevant Changes
* ChannelBuffer -> ByteBuf

* Headers on HttpObject are no longer accessed directly, but first by getting
the headers object using .headers()
the headers object using .headers()

* ChannelBuffers class is gone. Using ByteBufAllocator directly, plus EmptyByteBuf in place of EMPTY_BUFFER
20 changes: 0 additions & 20 deletions src/main/java/org/littleshoot/proxy/CachedHttpChunks.java

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/java/org/littleshoot/proxy/CachedHttpResponse.java

This file was deleted.

95 changes: 0 additions & 95 deletions src/main/java/org/littleshoot/proxy/DefaultCachedHttpChunks.java

This file was deleted.

38 changes: 0 additions & 38 deletions src/main/java/org/littleshoot/proxy/DefaultCachedHttpResponse.java

This file was deleted.

83 changes: 1 addition & 82 deletions src/main/java/org/littleshoot/proxy/DefaultHttpProxyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ public class DefaultHttpProxyServer implements HttpProxyServer {
*/
private final EventLoopGroup clientWorker;

private final ProxyCacheManager cacheManager;

/**
* Creates a new proxy server.
*
Expand Down Expand Up @@ -102,25 +100,6 @@ public DefaultHttpProxyServer(final int port,
new NioEventLoopGroup(MAXIMUM_SERVER_THREADS, SERVER_THREAD_FACTORY));
}

/**
* Creates a new proxy server.
*
* @param port
* The port the server should run on.
* @param responseFilters
* The {@link Map} of request domains to match with associated
* {@link HttpFilter}s for filtering responses to those requests.
*/
public DefaultHttpProxyServer(final int port,
final HttpResponseFilters responseFilters,
final ProxyCacheManager cacheManager) {
this(port, responseFilters, null, null, null,
new NioEventLoopGroup(MAXIMUM_CLIENT_THREADS, CLIENT_THREAD_FACTORY),
new NioEventLoopGroup(MAXIMUM_SERVER_THREADS, SERVER_THREAD_FACTORY),
new NioEventLoopGroup(MAXIMUM_SERVER_THREADS, SERVER_THREAD_FACTORY),
cacheManager);
}

/**
* Creates a new proxy server.
*
Expand All @@ -138,23 +117,6 @@ public HttpFilter getFilter(String hostAndPort) {
});
}

/**
* Creates a new proxy server.
*
* @param port
* The port the server should run on.
* @param requestFilter
* The filter for HTTP requests.
*/
public DefaultHttpProxyServer(final int port,
final ProxyCacheManager cacheManager) {
this(port, new HttpResponseFilters() {
public HttpFilter getFilter(String hostAndPort) {
return null;
}
}, cacheManager);
}

/**
* Creates a new proxy server.
*
Expand Down Expand Up @@ -262,44 +224,6 @@ public DefaultHttpProxyServer(final int port,
final EventLoopGroup clientWorker,
final EventLoopGroup serverBoss,
final EventLoopGroup serverWorker) {
this(port, responseFilters, chainProxyManager, handshakeHandlerFactory,
requestFilter, clientWorker,
serverBoss, serverWorker, ProxyUtils.loadCacheManager());
}

/**
* Creates a new proxy server.
*
* @param port
* The port the server should run on.
* @param responseFilters
* The {@link Map} of request domains to match with associated
* {@link HttpFilter}s for filtering responses to those requests.
* @param chainProxyManager
* The proxy to send requests to if chaining proxies. Typically
* <code>null</code>.
* @param ksm
* The key manager if running the proxy over SSL.
* @param requestFilter
* Optional filter for modifying incoming requests. Often
* <code>null</code>.
*
* @param clientWorker
* The EventLoopGroup for creating outgoing channels to external sites.
* @param serverBoss
* The EventLoopGroup for accepting incoming connections
* @param serverWorker
* The EventLoopGroup for processing incoming connections
*/
public DefaultHttpProxyServer(final int port,
final HttpResponseFilters responseFilters,
final ChainProxyManager chainProxyManager,
final HandshakeHandlerFactory handshakeHandlerFactory,
final HttpRequestFilter requestFilter,
final EventLoopGroup clientWorker,
final EventLoopGroup serverBoss,
final EventLoopGroup serverWorker,
final ProxyCacheManager cacheManager) {
this.port = port;
this.responseFilters = responseFilters;
this.handshakeHandlerFactory = handshakeHandlerFactory;
Expand All @@ -308,11 +232,6 @@ public DefaultHttpProxyServer(final int port,
this.clientWorker = clientWorker;
this.serverBoss = serverBoss;
this.serverWorker = serverWorker;
if (cacheManager == null) {
this.cacheManager = ProxyUtils.loadCacheManager();
} else {
this.cacheManager = cacheManager;
}
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
public void uncaughtException(final Thread t, final Throwable e) {
log.error("Uncaught throwable", e);
Expand All @@ -339,7 +258,7 @@ public void start(final boolean localOnly, final boolean anyAddress) {
new DefaultRelayChannelInitializerFactory(chainProxyManager,
this.responseFilters, this.requestFilter,
this.allChannels),
this.clientWorker, this.cacheManager);
this.clientWorker);
serverBootstrap.handler(initializer);


Expand Down
Loading

0 comments on commit abf6ac0

Please sign in to comment.