Re: return binary image data in camel/restlet environment

2013-10-09 Thread Zemin Hu
Thanks for quick fix, Willem. I will check it out. Actually your suggestion to set body to inputstream works very well, here is part of the code in case anybody wants to do the same: exchange.getOut().setHeader( Exchange.HTTP_RESPONSE_CODE, 200 ); exchange.getOut().s

Re: return binary image data in camel/restlet environment

2013-10-08 Thread Zemin Hu
Thanks Willem. I will try the work around. How do I know the fix is ready? Do I need to upgrade to latest Camel version in order to get fix? -- View this message in context: http://camel.465427.n5.nabble.com/return-binary-image-data-in-camel-restlet-environment-tp5741062p5741140.html Sent from

return binary image data in camel/restlet environment

2013-10-07 Thread Zemin Hu
I need to return image from route in restlet environment, if in normal camel environment I should be able to do byte[] imageData = getImage(); HttpServletResponse response = exchange.getIn().getBody(HttpServletResponse.class); response.setContentType("image/png"); OutputStream os = resp

How do I get instance of JobDetail from a quartz route

2013-02-14 Thread Zemin Hu
I have a route look like: ... Inside of this route, I need to access the JobDetail or StdScheduler since the configuration in the cron job may change, but I still can modify business logic within the route based on changed time schedule. I can see many information in the Camel HTTP headers: jobD

Re: HTTP Endpoint construction in CamelSpringTest

2013-01-24 Thread Zemin Hu
You are right. I was trying too hard to use CamelSpringTestSupport, thinking it might be simpler to start my route and to test it together. I am wrong. This CamelSpringTestSupport can do other tests, say file in Ibsen's book, but not for servlet. I am going to quit using CamelSpringTestSupport, jus

Re: HTTP Endpoint construction in CamelSpringTest

2013-01-24 Thread Zemin Hu
Actually I have been considering using jetty, I just have not tried out yet. Let me know if you have some ready samples in hand for this purpose. I would imagine if I use jetty, I have to put "jetty:" in front of all URIs, then remove them after unit test, if you want to do test again, you have to

HTTP Endpoint construction in CamelSpringTest

2013-01-23 Thread Zemin Hu
I am trying to use CamelSpringTestSupport to build my unit tests. Most of my routes are in Spring XML format. Here is my first test case: public class SimpeRouteTest extends CamelSpringTestSupport { protected AbstractXmlApplicationContext createApplicationContext() { return

Re: recipientList with POST and request body

2013-01-10 Thread Zemin Hu
I think I understand now why I can't do this with producerTemplate: yes, there is intensive security checks for our web service site, at this point to use producerTemplate I already logged in and got session in previous steps in the same route, the problem is that the security token with session in

Re: recipientList with POST and request body

2013-01-10 Thread Zemin Hu
Thanks. The camelContext is not causing exception anymore. The cause of the exception is: Caused by: org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking https://locker.att.net/service/content/1/playlists/158040465976 with statusCode: 302, redirectLocation: h

Re: recipientList with POST and request body

2013-01-10 Thread Zemin Hu
I posted the exception before, let me copy the exception again: the exception is: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: {"id":["48792683442"],"index":"0"}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionExc

Re: recipientList with POST and request body

2013-01-10 Thread Zemin Hu
I added a line: template.start() before sending request, it did not help, got same exception. I changed to context.start() it did not work either. The code is within bean implementation, so context is build-in variable, and started already, why do I need to start it again? From other example code,

Re: recipientList with POST and request body

2013-01-09 Thread Zemin Hu
I tried producerTemplate for bean approach (in groovy) too. I got exception when I tried to POST to an HTTP endpoint: def template = context.createProducerTemplate() def endpointUri = headers.END_POINT def xheaders = ["Content-Type":"application/json", "CamelHttpMethod":"PO

Re: recipientList with POST and request body

2013-01-09 Thread Zemin Hu
Willem, Thanks, I read some of your posts in the past, they were very helpful. I appreciate your advice. My currently situation is: I used beans for complicated business logic, to send different requests to different resources and to aggregate the results in the past. But now our company is moving

recipientList with POST and request body

2013-01-08 Thread Zemin Hu
Hi, I need to send request to a dynamically constructed URL list which provides RESTful web services. So my simplest need is to send POST requests with fixed JSON body, later I may need to construct different JSON body for each URL in the list as well, and since it's RESTful service, DELETE/PUT ar

support for RESTful endpoint or dynamic endpoint construction

2012-03-29 Thread Zemin Hu
Hi, I am new here, I posted this to developer forum which seems not good place for this, so I am re-posting it here. I have couple of RESTful web service that I want to use Camel as integration point. I had a brief review for restlet which is supposed to be the solution, but from I have seen, it's