If you use camel-cxfrs, you can just define the @FormParams and @QueryParams in the method signature of your REST resource class.
Then use the SimpleCxfRsBinding (see camel-cxfrs component doc), which parses the request, extracts all declared parameters and injects them as Camel headers. This way you completely avoid parsing the request yourself. And you have the benefit of an interface contract-driven implementation, which the neither Restlet nor Jetty components provide. If you are running below version 2.11, just copy the binding class into your project and reference it with the cxfBinding option. Regards, Raúl. On 15 May 2013 04:08, "wagnermarques" <wagnerdo...@gmail.com> wrote: > Hello camel riders, > > I would like to share a solution and ask if it was the best aproach. > I think it can be util for some one in the future and because is a > interesting example of integration using camel! > > > The use case: > I have a orbeon forms installed that was configured to: 1) save the form > date to existdb and 2) after it, send metadata of the form to my camel > route > described below. With the camel route, with the metadate of the form > submited (using camel-http) the route interact with existdb rest api to get > the real date of the form. > > > Ok, it is a simplification of the use case, because next step is improve it > with business rules upon form metadata and start a business process > deployed > in apache ode. But start the process from the route is not implemented yet > and not described here. > > > That is the code (sorry for much comments) > > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:cxf="http://camel.apache.org/schema/cxf" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > http://camel.apache.org/schema/cxf > http://camel.apache.org/schema/cxf/camel-cxf.xsd"> > > > <cxf:rsServer id="rsRestServices_OrbeonServer" > address="http://localhost:18181/orbeonservice" > > serviceClass="br.edu.fzlbpms.service.orbeon.ControllerService" /> > > > <camelContext xmlns="http://camel.apache.org/schema/spring"> > <route > id="FZLBPMS_CAMEL_ROUTE___cxfrs_bean_rsRestServices_OrbeonServer"> > <from uri="cxfrs:bean:rsRestServices_OrbeonServer" > /> > > > <setBody> > <constant>""</constant> > </setBody> > > <to > uri="Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR"/> > > > <setHeader headerName="CamelHttpUri"> > <simple> > > http://localhost:8282/exist/rest/db/orbeon/fr/${header.fzlbpms_orbeon_app}/${header.fzlbpms_orbeon_form}/data/${header.fzlbpms_orbeon_dataId}/data.xml?bridgeEndpoint=true > </simple> > </setHeader> > > > <inOut uri=" > http://doesnt.matter.we/override/it/anyways" /> > </route> > </camelContext> > > > > <bean id="messageInspectProcessor" > class="br.edu.fzlbpms.service.orbeon.MessageInspectProcessor" /> > > <bean id="Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR" > > class="br.edu.fzlbpms.service.orbeon.Pega_dados_do_formularioPROCESSOR" /> > > <bean id="BuildResponseProcessor" > class="br.edu.fzlbpms.service.orbeon.BuildResponseProcessor" /> > > </beans> > > > > This processor is important to distinct what data is camming from witch > form > by filling the values of the headers: > ${header.fzlbpms_orbeon_app} > ${header.fzlbpms_orbeon_form} > ${header.fzlbpms_orbeon_dataId} > > public class Pega_dados_do_formularioPROCESSOR implements Processor{ > > public void process(Exchange exchange) throws Exception { > > String camelHttpQuery = > (String)exchange.getIn().getHeader("CamelHttpQuery"); > > > > //app=existapp&form=existappform1&document=c757e862848cf9cc2e170d9325a1fc94c282a8e4 > String[] split = camelHttpQuery.split("&"); > > > //app=existapp > String[] appParam = split[0].split("="); > String app = appParam[1]; > > > String[] formParam = split[1].split("="); > String form = formParam[1]; > > String[] dataParam = split[2].split("="); > String dataId = dataParam[1]; > > > System.out.println("\n\n"); > System.out.println(app); > System.out.println(form); > System.out.println(dataId); > > exchange.getIn().setHeader("fzlbpms_orbeon_app", app); > exchange.getIn().setHeader("fzlbpms_orbeon_form", form); > exchange.getIn().setHeader("fzlbpms_orbeon_dataId", > dataId); > > } > > } > > > > I still have several problems and doubts, like basic autentications for > example, but for now I just would like to share and to ask about if it was > a > good aproach of this kind of integration (if it is relevant in some sense). > > Thanks, > > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Sharing-a-solution-for-discussion-tp5732560.html > Sent from the Camel - Users mailing list archive at Nabble.com. >