You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/06/15 08:24:02 UTC
camel git commit: Camel-netty4-http: Remove deprecated methods and
classes
Repository: camel
Updated Branches:
refs/heads/master 9f73fb218 -> 7b3117ab9
Camel-netty4-http: Remove deprecated methods and classes
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7b3117ab
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7b3117ab
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7b3117ab
Branch: refs/heads/master
Commit: 7b3117ab99033c23513cf4e5dce2be44591f0e41
Parents: 9f73fb2
Author: Andrea Cosentino <an...@gmail.com>
Authored: Wed Jun 15 10:21:52 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed Jun 15 10:23:32 2016 +0200
----------------------------------------------------------------------
.../netty4/http/DefaultNettyHttpBinding.java | 52 ++++++++++----------
.../component/netty4/http/NettyHttpHelper.java | 2 +-
.../netty4/http/NettyHttpProducer.java | 7 +--
.../netty4/http/RestNettyHttpBinding.java | 2 +-
.../http/handlers/HttpClientChannelHandler.java | 4 +-
.../http/handlers/HttpServerChannelHandler.java | 20 +++++---
.../HttpServerMultiplexChannelHandler.java | 8 +--
...ttpAccessHttpRequestAndResponseBeanTest.java | 3 +-
...ndingPreservePostFormUrlEncodedBodyTest.java | 2 +-
...ttyHttpBindingUseRelativePathInPostTest.java | 2 +-
.../netty4/http/NettyHttpGetWithParamTest.java | 2 +-
.../http/NettyHttpProducerKeepAliveTest.java | 4 +-
.../http/NettyHttpProducerSimpleTest.java | 4 +-
.../http/NettyUseRawHttpResponseTest.java | 3 +-
14 files changed, 64 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
index 6364f9a..1663464 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
@@ -34,6 +34,8 @@ import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.FullHttpResponse;
+import io.netty.handler.codec.http.HttpHeaderNames;
+import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpRequest;
@@ -108,9 +110,9 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
// NOTE: these headers is applied using the same logic as camel-http/camel-jetty to be consistent
- headers.put(Exchange.HTTP_METHOD, request.getMethod().name());
+ headers.put(Exchange.HTTP_METHOD, request.method().name());
// strip query parameters from the uri
- String s = request.getUri();
+ String s = request.uri();
if (s.contains("?")) {
s = ObjectHelper.before(s, "?");
}
@@ -129,7 +131,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
headers.put(Exchange.HTTP_URL, s);
// uri is without the host and port
- URI uri = new URI(request.getUri());
+ URI uri = new URI(request.uri());
// uri is path and query parameters
headers.put(Exchange.HTTP_URI, uri.getPath());
headers.put(Exchange.HTTP_QUERY, uri.getQuery());
@@ -149,8 +151,8 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
headers.put(Exchange.HTTP_PATH, path);
if (LOG.isTraceEnabled()) {
- LOG.trace("HTTP-Method {}", request.getMethod().name());
- LOG.trace("HTTP-Uri {}", request.getUri());
+ LOG.trace("HTTP-Method {}", request.method().name());
+ LOG.trace("HTTP-Uri {}", request.uri());
}
for (String name : request.headers().names()) {
@@ -182,8 +184,8 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
}
// add uri parameters as headers to the Camel message
- if (request.getUri().contains("?")) {
- String query = ObjectHelper.after(request.getUri(), "?");
+ if (request.uri().contains("?")) {
+ String query = ObjectHelper.after(request.uri(), "?");
Map<String, Object> uriParameters = URISupport.parseQuery(query, false, true);
for (Map.Entry<String, Object> entry : uriParameters.entrySet()) {
@@ -204,7 +206,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
// if body is application/x-www-form-urlencoded then extract the body as query string and append as headers
// if it is a bridgeEndpoint we need to skip this part of work
- if (request.getMethod().name().equals("POST") && request.headers().get(Exchange.CONTENT_TYPE) != null
+ if (request.method().name().equals("POST") && request.headers().get(Exchange.CONTENT_TYPE) != null
&& request.headers().get(Exchange.CONTENT_TYPE).startsWith(NettyHttpConstants.CONTENT_TYPE_WWW_FORM_URLENCODED)
&& !configuration.isBridgeEndpoint()) {
@@ -288,8 +290,8 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
public void populateCamelHeaders(FullHttpResponse response, Map<String, Object> headers, Exchange exchange, NettyHttpConfiguration configuration) throws Exception {
LOG.trace("populateCamelHeaders: {}", response);
- headers.put(Exchange.HTTP_RESPONSE_CODE, response.getStatus().code());
- headers.put(Exchange.HTTP_RESPONSE_TEXT, response.getStatus().reasonPhrase());
+ headers.put(Exchange.HTTP_RESPONSE_CODE, response.status().code());
+ headers.put(Exchange.HTTP_RESPONSE_TEXT, response.status().reasonPhrase());
for (String name : response.headers().names()) {
// mapping the content-type
@@ -395,7 +397,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
// TODO How to enable the chunk transport
int len = buffer.readableBytes();
// set content-length
- response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, len);
+ response.headers().set(HttpHeaderNames.CONTENT_LENGTH.toString(), len);
LOG.trace("Content-Length: {}", len);
} else {
response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(code));
@@ -424,28 +426,28 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
String contentType = MessageHelper.getContentType(message);
if (contentType != null) {
// set content-type
- response.headers().set(HttpHeaders.Names.CONTENT_TYPE, contentType);
+ response.headers().set(HttpHeaderNames.CONTENT_TYPE.toString(), contentType);
LOG.trace("Content-Type: {}", contentType);
}
// configure connection to accordingly to keep alive configuration
// favor using the header from the message
- String connection = message.getHeader(HttpHeaders.Names.CONNECTION, String.class);
+ String connection = message.getHeader(HttpHeaderNames.CONNECTION.toString(), String.class);
// Read the connection header from the exchange property
if (connection == null) {
- connection = message.getExchange().getProperty(HttpHeaders.Names.CONNECTION, String.class);
+ connection = message.getExchange().getProperty(HttpHeaderNames.CONNECTION.toString(), String.class);
}
if (connection == null) {
// fallback and use the keep alive from the configuration
if (configuration.isKeepAlive()) {
- connection = HttpHeaders.Values.KEEP_ALIVE;
+ connection = HttpHeaderValues.KEEP_ALIVE.toString();
} else {
- connection = HttpHeaders.Values.CLOSE;
+ connection = HttpHeaderValues.CLOSE.toString();
}
}
- response.headers().set(HttpHeaders.Names.CONNECTION, connection);
+ response.headers().set(HttpHeaderNames.CONNECTION.toString(), connection);
// Just make sure we close the channel when the connection value is close
- if (connection.equalsIgnoreCase(HttpHeaders.Values.CLOSE)) {
+ if (connection.equalsIgnoreCase(HttpHeaderValues.CLOSE.toString())) {
message.setHeader(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, true);
}
LOG.trace("Connection: {}", connection);
@@ -492,7 +494,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriForRequest, buffer);
int len = buffer.readableBytes();
// set content-length
- request.headers().set(HttpHeaders.Names.CONTENT_LENGTH, len);
+ request.headers().set(HttpHeaderNames.CONTENT_LENGTH.toString(), len);
LOG.trace("Content-Length: {}", len);
} else {
// we do not support this kind of body
@@ -547,7 +549,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
String contentType = MessageHelper.getContentType(message);
if (contentType != null) {
// set content-type
- request.headers().set(HttpHeaders.Names.CONTENT_TYPE, contentType);
+ request.headers().set(HttpHeaderNames.CONTENT_TYPE.toString(), contentType);
LOG.trace("Content-Type: {}", contentType);
}
@@ -555,21 +557,21 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
// use URI as its faster than URL (no DNS lookup)
URI u = new URI(uri);
String hostHeader = u.getHost() + (u.getPort() == 80 ? "" : ":" + u.getPort());
- request.headers().set(HttpHeaders.Names.HOST, hostHeader);
+ request.headers().set(HttpHeaderNames.HOST.toString(), hostHeader);
LOG.trace("Host: {}", hostHeader);
// configure connection to accordingly to keep alive configuration
// favor using the header from the message
- String connection = message.getHeader(HttpHeaders.Names.CONNECTION, String.class);
+ String connection = message.getHeader(HttpHeaderNames.CONNECTION.toString(), String.class);
if (connection == null) {
// fallback and use the keep alive from the configuration
if (configuration.isKeepAlive()) {
- connection = HttpHeaders.Values.KEEP_ALIVE;
+ connection = HttpHeaderValues.KEEP_ALIVE.toString();
} else {
- connection = HttpHeaders.Values.CLOSE;
+ connection = HttpHeaderValues.CLOSE.toString();
}
}
- request.headers().set(HttpHeaders.Names.CONNECTION, connection);
+ request.headers().set(HttpHeaderNames.CONNECTION.toString(), connection);
LOG.trace("Connection: {}", connection);
return request;
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpHelper.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpHelper.java
index e5d3c4f..cfdc4b4 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpHelper.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpHelper.java
@@ -124,7 +124,7 @@ public final class NettyHttpHelper {
public static Exception populateNettyHttpOperationFailedException(Exchange exchange, String url, FullHttpResponse response, int responseCode, boolean transferException) {
String uri = url;
- String statusText = response.getStatus().reasonPhrase();
+ String statusText = response.status().reasonPhrase();
if (responseCode >= 300 && responseCode < 400) {
String redirectLocation = response.headers().get("location");
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpProducer.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpProducer.java
index 4d4faf7..8a6b540 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpProducer.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpProducer.java
@@ -21,6 +21,7 @@ import java.net.URI;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpUtil;
import io.netty.util.ReferenceCountUtil;
import io.netty.util.ReferenceCounted;
import org.apache.camel.AsyncCallback;
@@ -62,10 +63,10 @@ public class NettyHttpProducer extends NettyProducer {
URI u = NettyHttpHelper.createURI(exchange, uri, getEndpoint());
final HttpRequest request = getEndpoint().getNettyHttpBinding().toNettyRequest(exchange.getIn(), u.toString(), getConfiguration());
- String actualUri = request.getUri();
+ String actualUri = request.uri();
exchange.getIn().setHeader(Exchange.HTTP_URL, actualUri);
// Need to check if we need to close the connection or not
- if (!HttpHeaders.isKeepAlive(request)) {
+ if (!HttpUtil.isKeepAlive(request)) {
// just want to make sure we close the channel if the keepAlive is not true
exchange.setProperty(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, true);
}
@@ -130,7 +131,7 @@ public class NettyHttpProducer extends NettyProducer {
// the actual url is stored on the IN message in the getRequestBody method as its accessed on-demand
String actualUrl = exchange.getIn().getHeader(Exchange.HTTP_URL, String.class);
- int code = response.getStatus() != null ? response.getStatus().code() : -1;
+ int code = response.status() != null ? response.status().code() : -1;
log.debug("Http responseCode: {}", code);
// if there was a http error code then check if we should throw an exception
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java
index ec9a493..55c77e1 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java
@@ -48,7 +48,7 @@ public class RestNettyHttpBinding extends DefaultNettyHttpBinding {
public void populateCamelHeaders(FullHttpRequest request, Map<String, Object> headers, Exchange exchange, NettyHttpConfiguration configuration) throws Exception {
super.populateCamelHeaders(request, headers, exchange, configuration);
- String path = request.getUri();
+ String path = request.uri();
if (path == null) {
return;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
index 1a9ab1e..04b0ad1 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
@@ -19,6 +19,8 @@ package org.apache.camel.component.netty4.http.handlers;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpHeaders;
+import io.netty.handler.codec.http.HttpUtil;
+
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.component.netty4.NettyConstants;
@@ -40,7 +42,7 @@ public class HttpClientChannelHandler extends ClientChannelHandler {
@Override
protected Message getResponseMessage(Exchange exchange, ChannelHandlerContext ctx, Object message) throws Exception {
FullHttpResponse response = (FullHttpResponse) message;
- if (!HttpHeaders.isKeepAlive(response)) {
+ if (!HttpUtil.isKeepAlive(response)) {
// just want to make sure we close the channel if the keepAlive is not true
exchange.setProperty(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, true);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java
index d528675..7134a46 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java
@@ -28,9 +28,13 @@ import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.base64.Base64;
import io.netty.handler.codec.http.DefaultHttpResponse;
+import io.netty.handler.codec.http.HttpHeaderNames;
+import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
+import io.netty.handler.codec.http.HttpUtil;
+
import org.apache.camel.Exchange;
import org.apache.camel.LoggingLevel;
import org.apache.camel.component.netty4.NettyConverter;
@@ -91,7 +95,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
// if its an OPTIONS request then return which methods is allowed
boolean isRestrictedToOptions = consumer.getEndpoint().getHttpMethodRestrict() != null
&& consumer.getEndpoint().getHttpMethodRestrict().contains("OPTIONS");
- if ("OPTIONS".equals(request.getMethod().name()) && !isRestrictedToOptions) {
+ if ("OPTIONS".equals(request.method().name()) && !isRestrictedToOptions) {
String s;
if (consumer.getEndpoint().getHttpMethodRestrict() != null) {
s = "OPTIONS," + consumer.getEndpoint().getHttpMethodRestrict();
@@ -107,7 +111,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
return;
}
if (consumer.getEndpoint().getHttpMethodRestrict() != null
- && !consumer.getEndpoint().getHttpMethodRestrict().contains(request.getMethod().name())) {
+ && !consumer.getEndpoint().getHttpMethodRestrict().contains(request.method().name())) {
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, METHOD_NOT_ALLOWED);
response.headers().set(Exchange.CONTENT_TYPE, "text/plain");
response.headers().set(Exchange.CONTENT_LENGTH, 0);
@@ -115,7 +119,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
ctx.channel().close();
return;
}
- if ("TRACE".equals(request.getMethod().name()) && !consumer.getEndpoint().isTraceEnabled()) {
+ if ("TRACE".equals(request.method().name()) && !consumer.getEndpoint().isTraceEnabled()) {
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, METHOD_NOT_ALLOWED);
response.headers().set(Exchange.CONTENT_TYPE, "text/plain");
response.headers().set(Exchange.CONTENT_LENGTH, 0);
@@ -124,7 +128,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
return;
}
// must include HOST header as required by HTTP 1.1
- if (!request.headers().contains(HttpHeaders.Names.HOST)) {
+ if (!request.headers().contains(HttpHeaderNames.HOST.toString())) {
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, BAD_REQUEST);
//response.setChunked(false);
response.headers().set(Exchange.CONTENT_TYPE, "text/plain");
@@ -137,7 +141,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
// is basic auth configured
NettyHttpSecurityConfiguration security = consumer.getEndpoint().getSecurityConfiguration();
if (security != null && security.isAuthenticate() && "Basic".equalsIgnoreCase(security.getConstraint())) {
- String url = request.getUri();
+ String url = request.uri();
// drop parameters from url
if (url.contains("?")) {
@@ -145,7 +149,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
}
// we need the relative path without the hostname and port
- URI uri = new URI(request.getUri());
+ URI uri = new URI(request.uri());
String target = uri.getPath();
// strip the starting endpoint path so the target is relative to the endpoint uri
@@ -288,10 +292,10 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
}
HttpRequest request = (HttpRequest) message;
// setup the connection property in case of the message header is removed
- boolean keepAlive = HttpHeaders.isKeepAlive(request);
+ boolean keepAlive = HttpUtil.isKeepAlive(request);
if (!keepAlive) {
// Just make sure we close the connection this time.
- exchange.setProperty(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);
+ exchange.setProperty(HttpHeaderNames.CONNECTION.toString(), HttpHeaderValues.CLOSE.toString());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerMultiplexChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerMultiplexChannelHandler.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerMultiplexChannelHandler.java
index b000f5d..fd8cb04 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerMultiplexChannelHandler.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerMultiplexChannelHandler.java
@@ -102,7 +102,7 @@ public class HttpServerMultiplexChannelHandler extends SimpleChannelInboundHandl
HttpServerChannelHandler handler = getHandler(request);
if (handler != null) {
- Attribute<HttpServerChannelHandler> attr = ctx.attr(SERVER_HANDLER_KEY);
+ Attribute<HttpServerChannelHandler> attr = ctx.channel().attr(SERVER_HANDLER_KEY);
// store handler as attachment
attr.set(handler);
if (msg instanceof HttpContent) {
@@ -123,7 +123,7 @@ public class HttpServerMultiplexChannelHandler extends SimpleChannelInboundHandl
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
- Attribute<HttpServerChannelHandler> attr = ctx.attr(SERVER_HANDLER_KEY);
+ Attribute<HttpServerChannelHandler> attr = ctx.channel().attr(SERVER_HANDLER_KEY);
HttpServerChannelHandler handler = attr.get();
if (handler != null) {
handler.exceptionCaught(ctx, cause);
@@ -150,12 +150,12 @@ public class HttpServerMultiplexChannelHandler extends SimpleChannelInboundHandl
HttpServerChannelHandler answer = null;
// need to strip out host and port etc, as we only need the context-path for matching
- String method = request.getMethod().name();
+ String method = request.method().name();
if (method == null) {
return null;
}
- String path = request.getUri();
+ String path = request.uri();
int idx = path.indexOf(token);
if (idx > -1) {
path = path.substring(idx + len);
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestAndResponseBeanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestAndResponseBeanTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestAndResponseBeanTest.java
index 54895c2..36c0b9a 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestAndResponseBeanTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestAndResponseBeanTest.java
@@ -20,6 +20,7 @@ import java.nio.charset.Charset;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpRequest;
+import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
@@ -68,7 +69,7 @@ public class NettyHttpAccessHttpRequestAndResponseBeanTest extends BaseNettyTest
HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
NettyConverter.toByteBuffer(reply.getBytes()));
- response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, reply.length());
+ response.headers().set(HttpHeaderNames.CONTENT_LENGTH.toString(), reply.length());
return response;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java
index a76957f..2d7daa7 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java
@@ -61,7 +61,7 @@ public class NettyHttpBindingPreservePostFormUrlEncodedBodyTest extends BaseNett
NettyHttpMessage in = (NettyHttpMessage) exchange.getIn();
FullHttpRequest request = in.getHttpRequest();
- assertNotEquals("Relative path should NOT be used in POST", "/myapp/myservice?query1=a&query2=b", request.getUri());
+ assertNotEquals("Relative path should NOT be used in POST", "/myapp/myservice?query1=a&query2=b", request.uri());
// send a response
exchange.getOut().getHeaders().clear();
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingUseRelativePathInPostTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingUseRelativePathInPostTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingUseRelativePathInPostTest.java
index b387602..8d2ffe6 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingUseRelativePathInPostTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingUseRelativePathInPostTest.java
@@ -61,7 +61,7 @@ public class NettyHttpBindingUseRelativePathInPostTest extends BaseNettyTest {
NettyHttpMessage in = (NettyHttpMessage) exchange.getIn();
FullHttpRequest request = in.getHttpRequest();
- assertEquals("Relative path not used in POST", "/myapp/myservice?query1=a&query2=b", request.getUri());
+ assertEquals("Relative path not used in POST", "/myapp/myservice?query1=a&query2=b", request.uri());
// send a response
exchange.getOut().getHeaders().clear();
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java
index 9e31337..682a5af 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java
@@ -66,7 +66,7 @@ public class NettyHttpGetWithParamTest extends BaseNettyTest {
NettyHttpMessage message = exchange.getIn(NettyHttpMessage.class);
assertNotNull(message.getHttpRequest());
- String uri = message.getHttpRequest().getUri();
+ String uri = message.getHttpRequest().uri();
assertTrue(uri.endsWith("one=uno&two=dos"));
exchange.getOut().setBody("Bye World");
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerKeepAliveTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerKeepAliveTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerKeepAliveTest.java
index e4c22f1..e209fd0 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerKeepAliveTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerKeepAliveTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.netty4.http;
+import io.netty.handler.codec.http.HttpHeaderNames;
+import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpHeaders;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
@@ -61,7 +63,7 @@ public class NettyHttpProducerKeepAliveTest extends BaseNettyTest {
});
assertMockEndpointsSatisfied();
- assertEquals(HttpHeaders.Values.CLOSE, ex.getOut().getHeader(HttpHeaders.Names.CONNECTION));
+ assertEquals(HttpHeaderValues.CLOSE.toString(), ex.getOut().getHeader(HttpHeaderNames.CONNECTION.toString()));
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerSimpleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerSimpleTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerSimpleTest.java
index 5bc428b..6eadd97 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerSimpleTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerSimpleTest.java
@@ -51,12 +51,12 @@ public class NettyHttpProducerSimpleTest extends BaseNettyTest {
NettyHttpMessage response = out.getOut(NettyHttpMessage.class);
assertNotNull(response);
- assertEquals(200, response.getHttpResponse().getStatus().code());
+ assertEquals(200, response.getHttpResponse().status().code());
// we can also get the response as body
HttpResponse body = out.getOut().getBody(HttpResponse.class);
assertNotNull(body);
- assertEquals(200, body.getStatus().code());
+ assertEquals(200, body.status().code());
assertMockEndpointsSatisfied();
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7b3117ab/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyUseRawHttpResponseTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyUseRawHttpResponseTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyUseRawHttpResponseTest.java
index 512c1e7..600addb 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyUseRawHttpResponseTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyUseRawHttpResponseTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.netty4.http;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
+import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
@@ -51,7 +52,7 @@ public class NettyUseRawHttpResponseTest extends BaseNettyTest {
public void process(Exchange exchange) throws Exception {
HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
NettyConverter.toByteBuffer("Bye World".getBytes()));
- response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, 9);
+ response.headers().set(HttpHeaderNames.CONTENT_LENGTH.toString(), 9);
exchange.getOut().setBody(response);
}