camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Custom URIResolver for Camel
Date Thu, 04 Aug 2011 09:44:41 GMT
Hi

I found a bug in the camel xslt component and have logged a ticket and
work on a fix
https://issues.apache.org/jira/browse/CAMEL-4305

On Thu, Aug 4, 2011 at 10:48 AM, shekher awasthi
<shekher.awasthi@gmail.com> wrote:
> can you please elaborate what you mean by
> " that the file is relative to where the JVM is starting"
>
> since i am using tomcat for my this application and my jvm is at the
> following location
> C:\Program Files\Java\jre6\bin\client
>
> i even tried to place the xsl file with respect to this jvm location but it
> did not worked
> i even tried this
>
>
> <to uri=*
> "xslt:file://C://target//inventory//updates//xlsconvertor//filXMLConverter.xsl"
> */>
> and other combination but still getting the same exception
> On Thu, Aug 4, 2011 at 1:44 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
>
>> On Thu, Aug 4, 2011 at 10:00 AM, shekher awasthi
>> <shekher.awasthi@gmail.com> wrote:
>> > thanks Claus for the reply
>> >  i tried even like this
>> >
>> > <to uri=*
>> >
>> "xslt:file://target/inventory/updates/xlsconvertor?fileName=filXMLConverter.xsl"
>> > */>
>> >
>> > and even
>> >
>> > <to uri=*
>> >
>> "xslt:file://target/inventory/updates/xlsconvertor/filXMLConverter.xsl"*/>
>> >  for the first part its giving me the foloowing exception
>> >
>> > org.apache.camel.RuntimeCamelException:
>> > org.apache.camel.FailedToCreateRouteException: Failed to create route
>> tutu
>> > at: >>>
>> >
>> To[xslt:file://target/inventory/updates/xlsconvertor?fileName=filXMLConverter.xsl]
>> > <<< in route: Route[[From[file://target/inve
>> > ntory/updates?noop=true]] -> [... because of Failed to resolve endpoint:
>> >
>> xslt://file://target/inventory/updates/xlsconvertor?fileName=filXMLConverter.xsl
>> > due to: target URL [file://target/inventory/updates/xlsconvertor]
>> >
>> > i am still clueless what i am doing wrong
>>
>> There is no fileName option on this component, use
>>
>>  "xslt:file://target/inventory/updates/xlsconvertor/filXMLConverter.xsl"
>>
>> Mind that the file is relative to where the JVM is starting. You can
>> use an absolute path if you add an extra slash.
>>
>> >
>> > On Thu, Aug 4, 2011 at 1:19 PM, Claus Ibsen <claus.ibsen@gmail.com>
>> wrote:
>> >
>> >> On Thu, Aug 4, 2011 at 9:40 AM, shekher awasthi
>> >> <shekher.awasthi@gmail.com> wrote:
>> >> > we are trying to use xsl for converting xml to our custom xml format
>> >> using
>> >> > camel and its out of the box xslt support here is a sample route
>> >> >
>> >> > <from uri="file://target/inventory/updates?noop=true"/>
>> >> >        <unmarshal>
>> >> >                <csv />
>> >> >            </unmarshal>
>> >> >       <to uri="bean:XMLConverter?method=processCSVInvoice" />
>> >> >       <to
>> >>
>> uri="xslt:file//target/inventory/updates/xlsconvertor/XMLConverter.xsl"/>
>> >> >      <to
>> uri="file://target/inventory/updates/test?fileName=test11.xml"/>
>> >> >    </route>
>> >> >
>> >> > my problem is when i am putting this xls file in the class path camel
>> is
>> >> > happily picking the xls and doing the work as per the route but moment
>> we
>> >> > are placing the xls file out of class path like in a file system camel
>> is
>> >> > unable to resolve this and we are struck as the whole purpose to use
>> xls
>> >> is
>> >> > to take custom xml formatting out of the jar
>> >> >
>> >>
>> >> By default the xslt looks in the classpath. If you want to read from
>> >> the file system, you need to prefix with file://
>> >> Notice the colon.
>> >>
>> >> Its documented here:
>> >> http://camel.apache.org/xslt
>> >>
>> >>
>> >> > as a workaround i tried to create a customURLResolver and than tried
>> to
>> >> use
>> >> > it as
>> >> >
>> >> > <from uri="file://target/inventory/updates?noop=true"/>
>> >> >        <unmarshal>
>> >> >                <csv />
>> >> >            </unmarshal>
>> >> >       <to uri="bean:XMLConverter?method=processCSVInvoice" />
>> >> >       <to
>> >>
>> uri="xslt:file//target/inventory/updates/xlsconvertor/XMLConverter.xsl?uriResolver=customURIResolver"/>
>> >> >      <to
>> uri="file://target/inventory/updates/test?fileName=test11.xml"/>
>> >> >    </route>
>> >> >
>> >> > but in this case camel is not calling my customURIResolver any idea
>> how i
>> >> > can make camel to use my custom URIResolver in place of its default
>> >> resolver
>> >> >
>> >> >
>> >> >
>> >> > thanks in advance
>> >> >
>> >> > Shekher
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> FuseSource
>> >> Email: cibsen@fusesource.com
>> >> Web: http://fusesource.com
>> >> Twitter: davsclaus, fusenews
>> >> Blog: http://davsclaus.blogspot.com/
>> >> Author of Camel in Action: http://www.manning.com/ibsen/
>> >>
>> >
>>
>>
>>
>> --
>>  Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message