public class ClientToProxyConnectionPre extends SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpRequest>
ChannelHandler.Sharable| 限定符和类型 | 字段和说明 |
|---|---|
static String |
HTTP_DATE_FORMAT |
static String |
HTTP_DATE_GMT_TIMEZONE |
private HttpProxyConfigOptions |
httpProxyConfigOptions |
static String |
NAME |
private HttpRequestWrapper |
request |
| 构造器和说明 |
|---|
ClientToProxyConnectionPre(HttpProxyConfigOptions httpProxyConfigOptions) |
| 限定符和类型 | 方法和说明 |
|---|---|
private io.netty.handler.codec.http.HttpResponse |
addHttp2StreamId(io.netty.handler.codec.http.HttpResponse response) |
void |
channelRead0(ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request) |
private void |
channelReadHtml(ChannelHandlerContext ctx) |
void |
exceptionCaught(ChannelHandlerContext ctx,
Throwable cause) |
private String |
getFilePath(String node) |
private void |
page404(ChannelHandlerContext ctx) |
private void |
pageError(ChannelHandlerContext ctx,
String message) |
private void |
responseHtml(ChannelHandlerContext ctx,
File file) |
private String |
sanitizeUri(ProxyRuleOption htmlObj) |
private ProxyRuleOption |
selectHttpProxy(ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request,
String host) |
private void |
sendAndCleanupConnection(ChannelHandlerContext ctx,
io.netty.handler.codec.http.FullHttpResponse response) |
private void |
sendError(ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpResponseStatus status,
String message) |
private void |
sendNotModified(ChannelHandlerContext ctx) |
private void |
setContentTypeHeader(io.netty.handler.codec.http.HttpResponse response,
File fileToCache) |
private static void |
setDateAndCacheHeaders(io.netty.handler.codec.http.HttpResponse response,
File fileToCache,
HttpHtmlOption httpHtmlOption) |
private static void |
setDateHeader(io.netty.handler.codec.http.FullHttpResponse response) |
private static ByteBuffer |
toByteBuffer(RandomAccessFile raf)
Mapped File way MappedByteBuffer 可以在处理大文件时,提升性能。
|
private HttpRequestWrapper |
wrapHttpRequest(io.netty.handler.codec.http.HttpRequest request,
ProxyRuleOption httpProxy,
org.zodiac.commons.model.network.HostAndPort hostAndPort,
String serverHostAndPort) |
acceptInboundMessage, channelReadchannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAdded, handlerRemovedpublic static final String NAME
private HttpProxyConfigOptions httpProxyConfigOptions
private HttpRequestWrapper request
public ClientToProxyConnectionPre(HttpProxyConfigOptions httpProxyConfigOptions)
public void channelRead0(ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request) throws Exception
channelRead0 在类中 SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpRequest>Exceptionprivate void channelReadHtml(ChannelHandlerContext ctx) throws Exception
Exceptionprivate void responseHtml(ChannelHandlerContext ctx, File file) throws Exception
Exceptionprivate void pageError(ChannelHandlerContext ctx, String message) throws Exception
Exceptionprivate void page404(ChannelHandlerContext ctx) throws Exception
Exceptionprivate static ByteBuffer toByteBuffer(RandomAccessFile raf) throws IOException
raf - RandomAccessFileIOException - IOExceptionpublic void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
exceptionCaught 在接口中 ChannelHandlerexceptionCaught 在接口中 ChannelInboundHandlerexceptionCaught 在类中 ChannelInboundHandlerAdapterprivate String sanitizeUri(ProxyRuleOption htmlObj)
private void sendError(ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpResponseStatus status, String message)
private void sendNotModified(ChannelHandlerContext ctx)
private void sendAndCleanupConnection(ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpResponse response)
private static void setDateHeader(io.netty.handler.codec.http.FullHttpResponse response)
private static void setDateAndCacheHeaders(io.netty.handler.codec.http.HttpResponse response,
File fileToCache,
HttpHtmlOption httpHtmlOption)
private void setContentTypeHeader(io.netty.handler.codec.http.HttpResponse response,
File fileToCache)
private io.netty.handler.codec.http.HttpResponse addHttp2StreamId(io.netty.handler.codec.http.HttpResponse response)
private ProxyRuleOption selectHttpProxy(ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, String host) throws Exception
Exceptionprivate HttpRequestWrapper wrapHttpRequest(io.netty.handler.codec.http.HttpRequest request, ProxyRuleOption httpProxy, org.zodiac.commons.model.network.HostAndPort hostAndPort, String serverHostAndPort)
Copyright © 2022 Zodiac. All rights reserved.