camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: How to create case insensitive URI route with netty4-http?
Date Fri, 01 May 2015 06:13:43 GMT
On Thu, Apr 30, 2015 at 10:18 PM, hzariv <hzariv@ebay.com> wrote:
> You are right. I turn on debug logging and I see what is happening. I have
> the following producer and consumer endpoints. Camel matches on the Consumer
> endpoint correctly (case insensitive) but the producer URL is created like:
> http://myapp.com:80/ws/svc/Shopping/shopping?callname=... (path is now
> /Shopping/shopping which is invalid) when I use /shopping on the request the
> producer URL is correct.
> How do I fix this?
>
> Consumer:
> camelContext.getEndpoint("netty4-http:http://0.0.0.0:8080/Shopping");
> Producer:
> camelContext.getEndpoint(String.format("netty4-http:http://%s:80/ws/svc/Shopping?throwExceptionOnFailure=false",
> "myapp.com"));
>

These 2 urls is not the same, one use port 8080, and the other port
80. And their context path is also different.

And its not clear what you do in your code. Do you do a consume ->
produce and expect somehow Camel to match those endpoints?
Can you explain and show code better?



> Hers is the DEBUG log:
>
> 11087 [Camel (camel-1) thread #0 - NettyEventExecutorGroup] INFO  -
> ID-D-SJC-00531208-50165-1430420447613-0-2 >>> (route2)
> from(http://0.0.0.0:8080/Shopping) --> choice <<< Pattern:InOut,
> Headers:{Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
> Accept-Encoding=gzip, deflate, Accept-Language=en-US,en;q=0.5, appid=xxxx,
> breadcrumbId=ID-D-SJC-00531208-50165-1430420447613-0-1,
> Cache-Control=max-age=0, callname=FindProducts, CamelHttpMethod=GET,
> CamelHttpPath=/shopping,
> CamelHttpQuery=callname=FindProducts&responseencoding=XML&appid=xxxx&version=829&QueryKeywords=MC723LL&MaxEntries=2&ProductSort=Title&IncludeSelector=DomainHistogram&SortOrder=Ascending,
> CamelHttpRawQuery=callname=FindProducts&responseencoding=XML&appid=xxxx&version=829&QueryKeywords=MC723LL&MaxEntries=2&ProductSort=Title&IncludeSelector=DomainHistogram&SortOrder=Ascending,
> CamelHttpUri=/shopping, CamelHttpUrl=http://0.0.0.0:8080/shopping,
> CamelNettyChannelHandlerContext=io.netty.channel.DefaultChannelHandlerContext@3042dc22,
> CamelNettyLocalAddress=/127.0.0.1:8080,
> CamelNettyRemoteAddress=/127.0.0.1:50489, Connection=keep-alive,
> Content-Length=0, Host=localhost:8080, If-Modified-Since=Thu, 30 Apr 2015
> 18:59:27 GMT, IncludeSelector=DomainHistogram, MaxEntries=2,
> ProductSort=Title, QueryKeywords=MC723LL, responseencoding=XML,
> SortOrder=Ascending, User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0)
> Gecko/20100101 Firefox/37.0, version=829},
> BodyType:org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache,
> Body:[Body is instance of org.apache.camel.StreamCache]
> 11128 [Camel (camel-1) thread #0 - NettyEventExecutorGroup] INFO  -
> ID-D-SJC-00531208-50165-1430420447613-0-2 >>> (route2) choice -->
> http://myapp.com:80/ws/svc/Shopping <<< Pattern:InOut,
> Headers:{Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
> Accept-Encoding=gzip, deflate, Accept-Language=en-US,en;q=0.5, appid=xxxx,
> breadcrumbId=ID-D-SJC-00531208-50165-1430420447613-0-1,
> Cache-Control=max-age=0, callname=FindProducts, CamelHttpMethod=GET,
> CamelHttpPath=/shopping,
> CamelHttpQuery=callname=FindProducts&responseencoding=XML&appid=xxxx&version=829&QueryKeywords=MC723LL&MaxEntries=2&ProductSort=Title&IncludeSelector=DomainHistogram&SortOrder=Ascending,
> CamelHttpRawQuery=callname=FindProducts&responseencoding=XML&appid=xxxx&version=829&QueryKeywords=MC723LL&MaxEntries=2&ProductSort=Title&IncludeSelector=DomainHistogram&SortOrder=Ascending,
> CamelHttpUri=/shopping, CamelHttpUrl=http://0.0.0.0:8080/shopping,
> CamelNettyChannelHandlerContext=io.netty.channel.DefaultChannelHandlerContext@3042dc22,
> CamelNettyLocalAddress=/127.0.0.1:8080,
> CamelNettyRemoteAddress=/127.0.0.1:50489, Connection=keep-alive,
> Content-Length=0, Host=localhost:8080, If-Modified-Since=Thu, 30 Apr 2015
> 18:59:27 GMT, IncludeSelector=DomainHistogram, MaxEntries=2,
> ProductSort=Title, QueryKeywords=MC723LL, responseencoding=XML,
> SortOrder=Ascending, User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0)
> Gecko/20100101 Firefox/37.0, version=829},
> BodyType:org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache,
> Body:[Body is instance of org.apache.camel.StreamCache]
> 11129 [Camel (camel-1) thread #0 - NettyEventExecutorGroup] DEBUG - >>>>
> Endpoint[http://myapp.com:80/ws/svc/Shopping] Exchange[Message: [Body is
> instance of org.apache.camel.StreamCache]]
> 11138 [Camel (camel-1) thread #0 - NettyEventExecutorGroup] DEBUG - Created
> new TCP client bootstrap connecting to myapp.com:80 with options:
> Bootstrap(group: NioEventLoopGroup, channelFactory: NioSocketChannel.class,
> options: {SO_KEEPALIVE=true, TCP_NODELAY=true, SO_REUSEADDR=true,
> CONNECT_TIMEOUT_MILLIS=10000}, handler:
> org.apache.camel.component.netty4.http.HttpClientInitializerFactory@765b53f)
> 11167 [Camel (camel-1) thread #0 - NettyEventExecutorGroup] DEBUG - Creating
> connector to address: myapp.com:80
> 11169 [Camel (camel-1) thread #0 - NettyEventExecutorGroup] DEBUG - Channel:
> [id: 0xae58aab0, /10.244.161.38:50490 => myapp.com/10.14.90.11:80] writing
> body: DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1,
> content: UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 0, cap: 0))
> GET http://myapp.com:80/ws/svc/Shopping/shopping?callname=FindProducts.....
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-create-case-insensitive-URI-route-with-netty4-http-tp5766517p5766558.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message