You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sleepyjamie <ja...@gmail.com> on 2010/03/03 14:05:54 UTC

Filter using XPath hosted on remote http server?

I've been using camel and spring extensively since 1.5 and would like to know
if the <filter> supports retrieving XPath from a remove http server.

For example, a traditional xpath in camel would be as follows:

<filter>
   <xpath>/do/filter</xpath>
   <to uri="direct:passedFilter"/>
</filter>

I would like to retrieve the XPath from a web server (the webserver would
return the Xpath as raw text):

<filter>
   <xpath src="http://www.mywebserver.com/xpath.txt"/>
   <to uri="passedFilter"/>
</filter>

Even a location on the hard drive would be suitable

<filter>
   <xpath src="file://xpath.txt"/>
   <to uri="direct:passedFilter"/>
</filter>



Currently In order to achieve the above I have to create a custom <bean/>
that retrieves the filter from the remote server and performs the filtering.
I see my customer filter <bean/> simply as another EIP which could be part
of camel's framework.
-- 
View this message in context: http://old.nabble.com/Filter-using-XPath-hosted-on-remote-http-server--tp27767939p27767939.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Filter using XPath hosted on remote http server?

Posted by Ashwin Karpe <as...@progress.com>.
Hi,

Is it not possible for you to use a bean filter and accomplish the same. In
your route if you receive a piece of payload from the HTTP server it will be
in the Exchange Body.

BTW, XPath filter will also work provided the payload is well formed XML
(HTML should also work). But if the payload is raw and not valid ML then you
will not be able to use XPath...

In this case, uou could use a bean as a filter to parse the payload as you
see fit and then make route decisions.

Hope this helps.

Cheers,

Ashwin... 


sleepyjamie wrote:
> 
> I've been using camel and spring extensively since 1.5 and would like to
> know if the <filter> supports retrieving XPath from a remove http server.
> 
> For example, a traditional xpath in camel would be as follows:
> 
> <filter>
>    <xpath>/do/filter</xpath>
>    <to uri="direct:passedFilter"/>
> </filter>
> 
> I would like to retrieve the XPath from a web server (the webserver would
> return the Xpath as raw text):
> 
> <filter>
>    <xpath src="http://www.mywebserver.com/xpath.txt"/>
>    <to uri="passedFilter"/>
> </filter>
> 
> Even a location on the hard drive would be suitable
> 
> <filter>
>    <xpath src="file://xpath.txt"/>
>    <to uri="direct:passedFilter"/>
> </filter>
> 
> 
> 
> Currently In order to achieve the above I have to create a custom <bean/>
> that retrieves the filter from the remote server and performs the
> filtering. I see my customer filter <bean/> simply as another EIP which
> could be part of camel's framework.
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: http://old.nabble.com/Filter-using-XPath-hosted-on-remote-http-server--tp27767939p27768333.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Filter using XPath hosted on remote http server?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I think this is a very rare use case, and I dont think we should add
something to camel-core. There is already a lot of stuff there
already.

And most people would probably not like to call a remote server to get
a simple xpath expression. And on sub sequent calls you may wont to
have it cached etc. Then it all just get more complex.



On Wed, Mar 3, 2010 at 3:12 PM, sleepyjamie <ja...@gmail.com> wrote:
>
> As I mentioned I am currently using a <bean/> to do the work, however this
> requires creating a bean for every filter, which can be annoying.
>
> eg,
>
> <bean id="filter1" class="...">
>   <property name="location" value="http://somewebsite/xpath1.txt"/>
> </bean>
>
>
> <bean id="filter2" class="...">
>   <property name="location" value="http://anotherwebsite/xpath2.txt"/>
> </bean>
>
>
> Thus, it would be more ideal for camel to handle this job. I understand the
> result when fetching the xpath could be anything. Perhaps the result should
> be XML defined by a Schema which is part of the camel framework.
>
> for example the xml could look like
>
> <CamelXPath>
>   <![CDATA[
>      /Xpath/query/goes/here
>   ]]>
> </CamelXPath>
>
> Just a thought
>
> --
> View this message in context: http://old.nabble.com/Filter-using-XPath-hosted-on-remote-http-server--tp27767939p27768717.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Filter using XPath hosted on remote http server?

Posted by sleepyjamie <ja...@gmail.com>.
As I mentioned I am currently using a <bean/> to do the work, however this
requires creating a bean for every filter, which can be annoying.

eg,

<bean id="filter1" class="...">
   <property name="location" value="http://somewebsite/xpath1.txt"/>
</bean>


<bean id="filter2" class="...">
   <property name="location" value="http://anotherwebsite/xpath2.txt"/>
</bean>


Thus, it would be more ideal for camel to handle this job. I understand the
result when fetching the xpath could be anything. Perhaps the result should
be XML defined by a Schema which is part of the camel framework.

for example the xml could look like

<CamelXPath>
   <![CDATA[
      /Xpath/query/goes/here
   ]]>
</CamelXPath>

Just a thought

-- 
View this message in context: http://old.nabble.com/Filter-using-XPath-hosted-on-remote-http-server--tp27767939p27768717.html
Sent from the Camel - Users mailing list archive at Nabble.com.