@@ -81,9 +81,7 @@ public void handle(final FullHttpRequest fullRequest, final ChannelHandlerContex
8181
8282 private void fetchGet (final FullHttpRequest inbound , final ChannelHandlerContext ctx , final String url ) {
8383 final HttpGet httpGet = new HttpGet (url );
84- //httpGet.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
8584 httpGet .setHeader (HTTP .CONN_DIRECTIVE , HTTP .CONN_KEEP_ALIVE );
86- httpGet .setHeader ("mao" , inbound .headers ().get ("mao" ));
8785
8886 httpclient .execute (httpGet , new FutureCallback <HttpResponse >() {
8987 @ Override
@@ -113,27 +111,17 @@ public void cancelled() {
113111 private void handleResponse (final FullHttpRequest fullRequest , final ChannelHandlerContext ctx , final HttpResponse endpointResponse ) throws Exception {
114112 FullHttpResponse response = null ;
115113 try {
116- // String value = "hello,kimmking";
117- // response = new DefaultFullHttpResponse(HTTP_1_1, OK, Unpooled.wrappedBuffer(value.getBytes("UTF-8")));
118- // response.headers().set("Content-Type", "application/json");
119- // response.headers().setInt("Content-Length", response.content().readableBytes());
120-
114+
121115
122116 byte [] body = EntityUtils .toByteArray (endpointResponse .getEntity ());
123- // System.out.println(new String(body));
124- // System.out.println(body.length);
117+
125118
126119 response = new DefaultFullHttpResponse (HTTP_1_1 , OK , Unpooled .wrappedBuffer (body ));
127120
128- response .headers ().set ("Content-Type" , "application/json" );
129121 response .headers ().setInt ("Content-Length" , Integer .parseInt (endpointResponse .getFirstHeader ("Content-Length" ).getValue ()));
130122
131123 filter .filter (response );
132124
133- // for (Header e : endpointResponse.getAllHeaders()) {
134- // //response.headers().set(e.getName(),e.getValue());
135- // System.out.println(e.getName() + " => " + e.getValue());
136- // }
137125
138126 } catch (Exception e ) {
139127 e .printStackTrace ();
0 commit comments