public class ClientToProxyConnectionPre
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpRequest>
| 限定符和类型 | 字段和说明 |
|---|---|
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(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request) |
private void |
channelReadHtml(io.netty.channel.ChannelHandlerContext ctx) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
private String |
getFilePath(String node) |
private void |
pageError(io.netty.channel.ChannelHandlerContext ctx,
String message) |
private void |
pageNotFound(io.netty.channel.ChannelHandlerContext ctx) |
private void |
responseHtml(io.netty.channel.ChannelHandlerContext ctx,
File file) |
private String |
sanitizeUri(ProxyRuleOption htmlObj) |
private ProxyRuleOption |
selectProxy(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request,
String host) |
private void |
sendAndCleanupConnection(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.FullHttpResponse response) |
private void |
sendError(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpResponseStatus status,
String message) |
private void |
sendNotModified(io.netty.channel.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) |
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharablepublic static final String NAME
private HttpProxyConfigOptions httpProxyConfigOptions
private HttpRequestWrapper request
public ClientToProxyConnectionPre(HttpProxyConfigOptions httpProxyConfigOptions)
public void channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request)
throws Exception
channelRead0 在类中 io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpRequest>Exceptionprivate void channelReadHtml(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
Exceptionprivate void responseHtml(io.netty.channel.ChannelHandlerContext ctx,
File file)
throws Exception
Exceptionprivate void pageError(io.netty.channel.ChannelHandlerContext ctx,
String message)
throws Exception
Exceptionprivate void pageNotFound(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
Exceptionprivate static ByteBuffer toByteBuffer(RandomAccessFile raf) throws IOException
raf - RandomAccessFileIOException - IOExceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
exceptionCaught 在接口中 io.netty.channel.ChannelHandlerexceptionCaught 在接口中 io.netty.channel.ChannelInboundHandlerexceptionCaught 在类中 io.netty.channel.ChannelInboundHandlerAdapterprivate String sanitizeUri(ProxyRuleOption htmlObj)
private void sendError(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpResponseStatus status,
String message)
private void sendNotModified(io.netty.channel.ChannelHandlerContext ctx)
private void sendAndCleanupConnection(io.netty.channel.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 selectProxy(io.netty.channel.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 © 2023 Zodiac. All rights reserved.