I am writing a custom connector, using Jersey, and I need to create a @Processor that takes a MultivaluedMap as a parameter and pass it on to my Jersey query.
I would expect my @Connector to have
@Processor
public String query(MultiValuedMap<String,String> params) {
...
return webResource.queryParams(params).get(String.class);
}
Then the xml.sample needs the example flow declaration but I can't find how to declare the parameter
<!-- BEGIN_INCLUDE(myconnector:qry) -->
<myconnector:qry params=" ??? " />
<!-- END_INCLUDE(myconnector:qry) -->
and the mule-config.xml needs the real parameter!
<flow name="testQuery">
<myconnector:qry params=" ??? " />
</flow>
Alternatively I could simply insert a string into the Jersey request like
@Processor
public String query(String paramString) {
return webResource. ??? .get(String.class);
}
but how do I append that String ("?age=45&language=en") to the query URL?
After much searching I came across the answer:
@Processor
Public void qry(List<String> param1,Map<String,String> param2) {
...
}
can be declared as
<!-- BEGIN_INCLUDE(myconnector:qry) -->
<myconnector:qry>
<myconnector:param1 ref="" />
<myconnector:param2 ref="" />
</myconnector:qry>
<!-- END_INCLUDE(myconnector:qry) -->