Author: sergeyb
Date: 2010-09-20 09:20:53 -0400 (Mon, 20 Sep 2010)
New Revision: 12995
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyClient.java
Log:
[JBWS-3116] Applying a slightly modified patch on behalf of Sverker Abrahamsson with
NettyClient now sending absolute RequestURIs only for proxy bound requests
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyClient.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyClient.java 2010-09-20
10:02:56 UTC (rev 12994)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyClient.java 2010-09-20
13:20:53 UTC (rev 12995)
@@ -172,9 +172,11 @@
WSResponseHandler responseHandler = new WSResponseHandler();
NettyHelper.setResponseHandler(channel, responseHandler);
-
+
//Send the HTTP request
- HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, reqMessage !=
null ? HttpMethod.POST : HttpMethod.GET, targetAddress);
+ String targetRequestUri = isProxyRequest(additionalHeaders) ? targetAddress :
getRelativeRequestUri(target);
+
+ HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, reqMessage !=
null ? HttpMethod.POST : HttpMethod.GET, targetRequestUri);
request.addHeader(HttpHeaders.Names.HOST, target.getHost());
request.addHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
setAdditionalHeaders(request, additionalHeaders);
@@ -271,7 +273,20 @@
transport.finished(resMetadata, resHeaders); //provide both headers and metadata
to the transport to allow for proper keepAlive checks
}
}
+
+ private static boolean isProxyRequest(Map<String, Object> additionalHeaders)
+ {
+ // callProps may also need to be checked
+ return additionalHeaders.containsKey(HttpHeaders.Names.PROXY_AUTHORIZATION);
+ }
+ private static String getRelativeRequestUri(URL target)
+ {
+ return target.getPath() +
+ (target.getQuery() != null ? "?" + target.getQuery() :
"") +
+ (target.getRef() != null ? "#" + target.getRef() :
"");
+ }
+
private static SslHandler getSSLHandler(URL target, Map<String, Object>
callProps) throws IOException
{
SslHandler handler = null;
Show replies by date