Juan José Vázquez Delgado pisze:
Hi everyone!

I´m writing my first application with cocoon 2.2 (M3) and have a problem. I´d like using a ImageReader but with a custom SourceFactory and protocol. For example, I´d like something like this inside the sitemap.xmap in my block:

<map:match pattern="/repo/folder/my_file.gif">
<map:read type="image" src="custom_protocol:///repo/folder/my_file.gif" mime-type="image/gif" />
</map:match>

I suposse that have to make a custom SourceFactory and Source but i don´t know how configure the factory and the protocol with spring in my block.

You are right, you must write custom SourceFactory and Source and register it 
as Spring's bean. For concrete example take a look at:
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/
(ServletSource and ServletSourceFactory)

And configuration should look like this one:
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-servlet-source-factory.xml

Source is registered with 'servlet' scheme. You specify it at the end of bean's 
name (after slash sign). Rest should be obvious.

--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

Reply via email to