Can (should?) a TypeConverter set the Content-Type?

2014-09-03 Thread pmcb55
I have a simple Camel TypeConverter that converts my Java objects to JSON and returns that JSON as an InputStream. This is for transmitting instances of my Java objects over HTTP. This works fine, but the problem is that I also want the converter to also set the Content-Type on the Exchange so tha

Re: Why do these two trivial Jetty routes return different response codes?

2014-07-09 Thread pmcb55
So, to answer my own question, the problem was that I was using 'constant(200)' inside the anonymous route processor! The use of the 'constant()' method is only applicable when using methods on the route itself, such as: .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200)) but within an act

Why do these two trivial Jetty routes return different response codes?

2014-07-08 Thread pmcb55
Hi, I can't understand why the following code produces different outputs for two trivial Jetty routes. The first route uses an anonymous processor to set the HTTP response code to 200, but the output actually displays 500 (and the body contains an HTML error from Jetty). The second route uses '.s

Closed issue CAMEL-6628 in 2.12.0 doesn't fix the problem!

2014-02-07 Thread pmcb55
Hi guys, Back in Aug 2013 Claus implemented a change to allow event notifications in the producer template to be turned on or off: https://issues.apache.org/jira/browse/CAMEL-6628 But in fact this change isn't quite right. The test case below

BUG: Stack Overflow with long recipient list using default delimiter.

2014-01-07 Thread pmcb55
Hi, The JUnit test below illustrates a Stack Overflow bug when using a long recipient list with the default delimiter (a comma). The overflow is caused by a regex (",(?!(?:[^\\(,]|[^\\)],[^\\)])+\\))") in the 'createIterator()' method in the class 'org.apache.camel.util.ObjectHelper', which is us

Is this a valid Camel endpoint URI: 'http://example.com/hello%3Fworld/'?

2013-11-08 Thread pmcb55
Hi, Using Camel 2.11.0, if I try this: * from("direct:test").to("http4://example.com/hello%3Fworld/");* ...Camel URLDecodes this URI to instead invoke on: *http4://www.example.com/service/hello?world/*, which HTTP then interprets as a URI having a query parameter of 'world/'. This is very d

Re: How to stop URLDecoding on *path* of URI (*NOT* query parameters)?

2013-11-02 Thread pmcb55
Anyone got any suggestions at all?!!? -- View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-URLDecoding-on-path-of-URI-NOT-query-parameters-tp5742409p5742546.html Sent from the Camel - Users mailing list archive at Nabble.com.

How to stop URLDecoding on *path* of URI (*NOT* query parameters)?

2013-10-30 Thread pmcb55
Hi, Using Camel 2.11.0, we have an unusual requirement of needing to invoke this type of URI: *http://www.example.com/service/hello%3Fworld/* Note the '%3F' in the *path* of the URI, which is the encoding for '?'. This is very different than handling query parameters, for which we successfully

Re: Bug with 'addEventNotifier' - fires two 'exchange sent' events for each Exchange sent.

2013-08-12 Thread pmcb55
Well actually, our production code makes extensive use of the ProducerTemplate to make explicit calls from our application server code (which just supports a standard web application) to simple Camel routes that invoke on backend services that all expose HTTP endpoints (so of course we use the HTTP

Re: Bug with 'addEventNotifier' - fires two 'exchange sent' events for each Exchange sent.

2013-08-12 Thread pmcb55
Hi Claus - thanks again for the response, but I'm still unclear. I've been playing with my test code, and I think this version might illustrate the problem better (I now define endpoints instead of my simpler original that only had a 'Processor()', and I've added 'Thread.sleep()' to the endpoints t

Re: Bug with 'addEventNotifier' - fires two 'exchange sent' events for each Exchange sent.

2013-08-12 Thread pmcb55
Hi Claus, Ok, great. But you seem to be implying that this is 'correct' behaviour - which I don't quite understand. What is the value of the events fired from the ProducerTemplate when the underlying code fires the same events anyway? I guess maybe I'm still missing something here... So how would

Bug with 'addEventNotifier' - fires two 'exchange sent' events for each Exchange sent.

2013-08-11 Thread pmcb55
Hi, I'm using Camel 2.11.1 and the *context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() { ... });* to gather event timings for my Camel application. Everything works fine except I get *two* events fired for every Exchange sent to my trivial test route. The following test c

Re: Why do Camel core methods still throw Checked Exceptions (everyone agrees they're 'bad' now, right?)

2013-05-16 Thread pmcb55
Thanks a million for the response Hadrian. That was what I kinda suspected (i.e. legacy reasons). Your response makes me very confident now that wrapping the offending methods is the correct action for me right now (it's pretty trivial for me to do anyway). That way I get rid of the nasty (i.e. 'n

Re: Why do Camel core methods still throw Checked Exceptions (everyone agrees they're 'bad' now, right?)

2013-05-15 Thread pmcb55
Hi Christian, Thanks for the reply. Basically the issue with Camel throwing Checked Exceptions is that my code now has to declare those Checked Exceptions, which I concern just 'noise' (i.e. they add no value to my code, and now my Unit tests are infected with 'throws Exception' clauses that they

Why do Camel core methods still throw Checked Exceptions (everyone agrees they're 'bad' now, right?)

2013-05-12 Thread pmcb55
I've been using Camel for a while (and it's great), but one issue bugs me - many of the methods in the core Camel interfaces throw Checked Exceptions, e.g. the fundamental 'void process(Exchange exchange) *throws Exception*;', or CamelContext methods, like 'addRoutes()' or 'start()'. Doesn't the J

Re: Why do all Camel components have the same version number?

2013-04-10 Thread pmcb55
Yep - I get that Don, and I agree that that is certainly a benefit. I'm just wondering if it's worth the cost of re-releasing a new version of 'everything' if I only want to make a small (but maybe critical) change to one small isolated component that no other part of the system depends on...? May

Why do all Camel components have the same version number?

2013-04-10 Thread pmcb55
I'm intrigued by the versioning strategy used for Camel components. I'm wondering why all 80 (or whatever) Camel component JARs share the same version number. I assume very few of these components have code changes between releases (since Camel is very stable), so why not only bump up their version

How would you implement this simple, but tricky little route?

2013-02-15 Thread pmcb55
For each message that arrives on a queue, I want to kick-off a polling timer to periodically check a specific database row *for that message*, checking for a 'safeToContinue' flag changing value from 'false' to 'true'. Once the corresponding flag in the database for that message (i.e. the message b

How to start a polling Timer route for each message received?

2013-02-13 Thread pmcb55
Hi, I'm trying to implement a simple, but tricky little route! For each message that arrives on a queue I want to kick-off a polling timer to periodically check a specific database row for a 'safeToContinue' flag changing value from 'false' to 'true'. Once the corresponding flag in the database f

Re: Ampersand in URI query parameter not working (CAMEL-4857 doesn't fix)

2012-10-14 Thread pmcb55
Hi Claus, I'm using the latest released Camel version (2.10.0), but also tried with the trunk version too. I don't think your suggestion would work for me, as I need to create a recipient list, with each recipient having different query parameters, so I need to encode those query params into each

Re: Ampersand in URI query parameter not working (CAMEL-4857 doesn't fix)

2012-10-12 Thread pmcb55
Hi Donald - you're a GENIUS, that worked!! I would never have thought of that solution, but it certainly gets us over our problem. I would certainly think this gotcha should be reflected on the Camel documentation though, just as a warning note... Many thanks, Pat. -- View this message in co

Re: Ampersand in URI query parameter not working (CAMEL-4857 doesn't fix)

2012-10-11 Thread pmcb55
Hi Hadrian, Thanks for the response (the activity and responsiveness of this group continues to really impress me!). But it's a bit of a concern that correct handling of something as fundamental as URI's needs a major overhaul and a version 3.0 release to get 'right' ! This is a real problem for

Ampersand in URI query parameter not working (CAMEL-4857 doesn't fix)

2012-10-11 Thread pmcb55
I have a very simple use-case that seems to highlight a bug in Camel's URI handling code. It's very easy to demonstrate, the following code shows the problem: String query = URLEncoder.encode("D & B", "UTF-8"); String endpoint = "https4://www.google.com/?" + query;

Re: How to mock endpoints taking lots of different query parameters values?

2012-09-22 Thread pmcb55
Hi Claus, Yep - I've come around to thinking exactly as you state above, and in fact I did get everything working fine with 'adviceWith()'. But as I stated originally, I still think for newbies (like me!), the following code is far more intuitive than using 'adviceWith()': Processor emulator

Re: How to mock endpoints taking lots of different query parameters values?

2012-09-20 Thread pmcb55
Hi Claus, I don't think your idea will work for me. In my example above I did statically list all the query parameter combinations, but in my real code they are generated dynamically. So really my route looks more like: from("direct:start").process(new ClassThatGeneratesDynamicUriHeader()).reci

Re: How to mock endpoints taking lots of different query parameters values?

2012-09-19 Thread pmcb55
Hi Willem, Thanks for the comment - and yes, I probably could add a custom MockComponent like you say, but that's a lot more work than I think a developer should have to do. The reason to have a single mock to handle numerous query parameters is simply that the actual thing I'm mocking is a compl

How to mock endpoints taking lots of different query parameters values?

2012-09-19 Thread pmcb55
So I have a very simple mocking use-case. Basically I want to do the following: Processor emulator = new ServiceEmulator(); MockEndpoint mock = getMockEndpoint("mock:Service"); mock.whenAnyExchangeReceived(emulator); This is fine, but if I want to invoke my mock with query parameters

Re: Http4 component throws useless NPE if request body is String (instead of InputStream)

2012-08-15 Thread pmcb55
Hi Claus, Ok - I think I've tracked this problem down (after a lot of frustration and wasted time!). You should be easily able to reproduce the problem with the code I posted originally if you simply use HttpComponent version 4.2 (i.e. 'httpclient-4.2.jar' and 'httpcore-4.2.jar'). The latest versi

Re: Http4 component throws useless NPE if request body is String (instead of InputStream)

2012-08-14 Thread pmcb55
Hi Willem, If you look again at the source code I attached (it will run as a very simple JUnit test) - you'll see that the code gets the exception information, but that information is a useless NullPointerException. This exception gives no clue to the fact that the actual exception is a type-conve

Re: Http4 component throws useless NPE if request body is String (instead of InputStream)

2012-08-14 Thread pmcb55
Hi Claus - we're using the latest version 2.10.0. Simply running the JUnit test I provided should illustrate the problem - the 'System.out.println()' displays 'null' for both the exception description, and the exception cause - not particularly helpful, obviously! Cheers, Pat. -- View this m

Http4 component throws useless NPE if request body is String (instead of InputStream)

2012-08-13 Thread pmcb55
We've been using the Camel HTTP4 component for a while now, but today we wanted to call a HTTP endpoint and pass some text as input to the endpoint. But when we use 'exchange.getIn().setBody("Some input string...");' we got a very unhelpful NullPointerException (i.e. no detail information, no stack

Re: Basic 'camel-test' unit test dependent on Spring

2012-07-04 Thread pmcb55
Hi Claus, Yep, I just upgraded to Camel 2.10.0 and it works fine - thanks so much for the speedy (and accurate!) response, very much appreciated! Pat. -- View this message in context: http://camel.465427.n5.nabble.com/Basic-camel-test-unit-test-dependent-on-Spring-tp5715495p5715501.html Sent f

Basic 'camel-test' unit test dependent on Spring

2012-07-04 Thread pmcb55
I've just started using the camel testing framework, but I get a 'java.lang.NoClassDefFoundError: org/apache/camel/spring/CamelBeanPostProcessor' when I run my simple unit test. I'm using 'camel-test', as I don't yet have any dependency on Spring, but it seems to depend on Spring regardless. See th

Re: Simplest Camel HTTP4 example not working!

2012-06-12 Thread pmcb55
Yeah, the root of my problem was simply a proxy setting. Perhaps some improved error reporting from the code would have helped me sort this out a lot quicker (or even just a simple 'Tip:' box in the documentation for the HTTP/HTTP4 component)...! Anyway, I'm progressing now, thanks! -- View this

Re: Simplest Camel HTTP4 example not working!

2012-06-12 Thread pmcb55
Turns out my code was fine, as it works from my home computer - the problem is that the connection is being refused from my work network for some reason, resulting in the connection timing out. So I guess I'll have to jump down to the HttpClient level now to determine why... -- View this message i

Simplest Camel HTTP4 example not working!

2012-06-11 Thread pmcb55
Hi, I'm using Camel already, but am now trying to use the HTTP component, and started with the simplest possible usage I can think of - sending a simple search query to Google using a ProducerTemplate. The code runs, but just hangs on the 'template.request(...' call until a timeout of two minutes