I'm a little bit alone here…but…I've fixed the problem…
public class TestBean {
public String test(@Header("DATA") String data) {
return "Tested with TestBean: " + data;
}
}
On Thu, Oct 18, 2012 at 3:07 PM, Martin Stiborský
<[email protected]> wrote:
> Oh, again me here :) Now I see the problem. {DATA} is not passed to
> the testBean…
> This needs to be solved.
>
> On Thu, Oct 18, 2012 at 3:03 PM, Martin Stiborský
> <[email protected]> wrote:
>> Ooops. I guess, I was trying to find there something complicated, but
>> it works just like that:
>>
>> from("restlet:{{rest.base}}/test2/{DATA}").beanRef("testBean");
>>
>> Where testBean is just a HelloWorld style bean:
>>
>> public class TestBean {
>>
>> public String test(String data) {
>> return "Tested with TestBean: " + data;
>> }
>> }
>>
>> Is it all correct? Or not, or at least, what should be improved or
>> something? :)
>>
>> Thanks.
>>
>> On Thu, Oct 18, 2012 at 2:02 PM, Martin Stiborský
>> <[email protected]> wrote:
>>> Hello guys,
>>> I'm here again with probably quite obvious things that I haven't
>>> understood or missed.
>>> Let's describe my scenario. I want to provide REST interface on the
>>> "from()" side of the Camel route, and HTML/JSON/XML/etc stream on the
>>> other side, that is the "to()" side in Camel routes terms.
>>>
>>> Right now, I don't have any "to()", because I don't know which
>>> component I should use there for my purpose.
>>> I just create the REST interface, then I do something in the route
>>> with help of Processor and then send the result back with in
>>> exchange.getOut().setBody().
>>>
>>> I don't like that, I want to get rid of Processor and replace it with
>>> bean(s), I'm working on that.
>>> But what I should use as the "to()" side? Maybe my custom Component?
>>> It's producer, right? It will be producing data (XML or JSON, or
>>> whatever is the required format of data) computed by the inputs given
>>> via REST interface.
>>>
>>> Does Camel offers something what exactly match my situation?
>>>
>>> Btw, here is a simple snippet, how it works for me right now:
>>>
>>> from("restlet:{{rest.base}}/test")
>>> .process(new Processor() {
>>> @Override
>>> public void process(Exchange exchange) throws Exception {
>>> Response response =
>>> exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE,
>>> Response.class);
>>>
>>> response.setEntity("test", MediaType.TEXT_PLAIN);
>>> exchange.getOut().setBody(response);
>>> }
>>> });
>>>
>>>
>>> Thanks guys!
>>>
>>> --
>>> S pozdravem
>>> Martin Stiborský
>>>
>>> Jabber: [email protected]
>>
>>
>>
>> --
>> S pozdravem
>> Martin Stiborský
>>
>> Jabber: [email protected]
>
>
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: [email protected]
--
S pozdravem
Martin Stiborský
Jabber: [email protected]