|
@@ -17,12 +17,8 @@
|
|
*/
|
|
*/
|
|
package org.apache.hadoop.ozone.web.netty;
|
|
package org.apache.hadoop.ozone.web.netty;
|
|
|
|
|
|
-import static io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
|
|
|
|
-import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
|
|
|
|
-import static io.netty.handler.codec.http.HttpHeaderNames.HOST;
|
|
|
|
-import static io.netty.handler.codec.http.HttpHeaderNames.TRANSFER_ENCODING;
|
|
|
|
-import static io.netty.handler.codec.http.HttpHeaderValues.CLOSE;
|
|
|
|
-import static io.netty.handler.codec.http.HttpHeaderValues.KEEP_ALIVE;
|
|
|
|
|
|
+import static io.netty.handler.codec.http.HttpHeaders.Names.*;
|
|
|
|
+import static io.netty.handler.codec.http.HttpHeaders.Values.*;
|
|
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
|
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -46,7 +42,7 @@ import com.sun.jersey.spi.container.ContainerResponseWriter;
|
|
import com.sun.jersey.spi.container.WebApplication;
|
|
import com.sun.jersey.spi.container.WebApplication;
|
|
|
|
|
|
import io.netty.handler.codec.http.DefaultHttpResponse;
|
|
import io.netty.handler.codec.http.DefaultHttpResponse;
|
|
-import io.netty.handler.codec.http.HttpHeaderUtil;
|
|
|
|
|
|
+//import io.netty.handler.codec.http.HttpUtil;
|
|
import io.netty.handler.codec.http.HttpHeaders;
|
|
import io.netty.handler.codec.http.HttpHeaders;
|
|
import io.netty.handler.codec.http.HttpRequest;
|
|
import io.netty.handler.codec.http.HttpRequest;
|
|
import io.netty.handler.codec.http.HttpResponse;
|
|
import io.netty.handler.codec.http.HttpResponse;
|
|
@@ -262,7 +258,7 @@ public final class ObjectStoreJerseyContainer {
|
|
this.nettyResp = jerseyResponseToNettyResponse(jerseyResp);
|
|
this.nettyResp = jerseyResponseToNettyResponse(jerseyResp);
|
|
this.nettyResp.headers().set(CONTENT_LENGTH, Math.max(0, contentLength));
|
|
this.nettyResp.headers().set(CONTENT_LENGTH, Math.max(0, contentLength));
|
|
this.nettyResp.headers().set(CONNECTION,
|
|
this.nettyResp.headers().set(CONNECTION,
|
|
- HttpHeaderUtil.isKeepAlive(this.nettyReq) ? KEEP_ALIVE : CLOSE);
|
|
|
|
|
|
+ HttpHeaders.isKeepAlive(this.nettyReq) ? KEEP_ALIVE : CLOSE);
|
|
this.latch.countDown();
|
|
this.latch.countDown();
|
|
LOG.trace(
|
|
LOG.trace(
|
|
"end writeStatusAndHeaders, contentLength = {}, jerseyResp = {}.",
|
|
"end writeStatusAndHeaders, contentLength = {}, jerseyResp = {}.",
|
|
@@ -339,9 +335,9 @@ public final class ObjectStoreJerseyContainer {
|
|
String host = nettyHeaders.get(HOST);
|
|
String host = nettyHeaders.get(HOST);
|
|
String scheme = host.startsWith("https") ? "https://" : "http://";
|
|
String scheme = host.startsWith("https") ? "https://" : "http://";
|
|
String baseUri = scheme + host + "/";
|
|
String baseUri = scheme + host + "/";
|
|
- String reqUri = scheme + host + nettyReq.uri();
|
|
|
|
|
|
+ String reqUri = scheme + host + nettyReq.getUri();
|
|
LOG.trace("baseUri = {}, reqUri = {}", baseUri, reqUri);
|
|
LOG.trace("baseUri = {}, reqUri = {}", baseUri, reqUri);
|
|
- return new ContainerRequest(webapp, nettyReq.method().name(),
|
|
|
|
|
|
+ return new ContainerRequest(webapp, nettyReq.getMethod().name(),
|
|
new URI(baseUri), new URI(reqUri), jerseyHeaders, reqIn);
|
|
new URI(baseUri), new URI(reqUri), jerseyHeaders, reqIn);
|
|
}
|
|
}
|
|
}
|
|
}
|