Skip to content

Commit 2f9748f

Browse files
author
hiram
committed
调整下格式
1 parent c4a39a3 commit 2f9748f

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

02nio/nio02/src/main/java/io/github/kimmking/gateway/inbound/HttpInboundServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public class HttpInboundServer {
2020
private static Logger logger = LoggerFactory.getLogger(HttpInboundServer.class);
2121

2222
private int port;
23-
23+
2424
private List<String> proxyServerList;
2525

2626
public HttpInboundServer(int port, List<String> proxyServerList) {
27-
this.port=port;
27+
this.port = port;
2828
this.proxyServerList = proxyServerList;
2929
}
3030

02nio/nio02/src/main/java/io/github/kimmking/gateway/outbound/netty4/NettyHttpClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void connect(FullHttpRequest fullHttpRequest, ChannelHandlerContext ctx)
3030
b.group(workerGroup);
3131
b.channel(NioSocketChannel.class);
3232
b.option(ChannelOption.SO_KEEPALIVE, true)
33-
.option(ChannelOption.SO_RCVBUF, 32 * 1024);
33+
.option(ChannelOption.SO_RCVBUF, 32 * 1024);
3434
b.handler(new ChannelInitializer<SocketChannel>() {
3535
@Override
3636
public void initChannel(SocketChannel ch) throws Exception {

02nio/nio02/src/main/java/io/github/kimmking/gateway/outbound/netty4/NettyHttpOutboundHandler.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ public class NettyHttpOutboundHandler extends ChannelInboundHandlerAdapter {
2020
private int contentLength = 0;
2121
private FullHttpRequest fullHttpRequest = null;
2222
private String backendUrl;
23+
2324
public NettyHttpOutboundHandler(ChannelHandlerContext ctx, FullHttpRequest fullHttpRequest, String backendUrl) {
2425
this.parentCtx = ctx;
2526
this.fullHttpRequest = fullHttpRequest;
2627
this.backendUrl = backendUrl;
2728
}
29+
2830
@Override
2931
public void channelActive(ChannelHandlerContext ctx)
3032
throws Exception {
@@ -40,15 +42,15 @@ public void channelActive(ChannelHandlerContext ctx)
4042
/*DefaultFullHttpRequest request = new DefaultFullHttpRequest(
4143
HttpVersion.HTTP_1_1, HttpMethod.GET, new URI("/").toASCIIString());*/
4244

43-
// 构建http请求
44-
request.headers().set(HttpHeaderNames.HOST, host);
45-
request.headers().set(HttpHeaderNames.CONNECTION,
46-
HttpHeaderNames.CONNECTION);
47-
request.headers().set(HttpHeaderNames.CONTENT_LENGTH,
48-
request.content().readableBytes());
45+
// 构建http请求
46+
request.headers().set(HttpHeaderNames.HOST, host);
47+
request.headers().set(HttpHeaderNames.CONNECTION,
48+
HttpHeaderNames.CONNECTION);
49+
request.headers().set(HttpHeaderNames.CONTENT_LENGTH,
50+
request.content().readableBytes());
4951
ctx.writeAndFlush(request);
5052
}
51-
53+
5254
@Override
5355
public void channelRead(ChannelHandlerContext ctx, Object msg)
5456
throws Exception {

02nio/nio02/src/main/java/io/github/kimmking/gateway/router/MyFirstHttpEndpointRouter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.List;
88
import java.util.Random;
99

10-
public class MyFirstHttpEndpointRouter implements HttpEndpointRouter{
10+
public class MyFirstHttpEndpointRouter implements HttpEndpointRouter {
1111

1212
@Override
1313
public String route(List<String> endpoints) {

0 commit comments

Comments
 (0)