[DAISY] Updated: Overview

[email protected]
Newsgroups gmane.text.xml.cocoon.documentation
Message-ID <[email protected]>
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1468.html

Document ID: 1468
Branch: main
Language: default
Name: Overview (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 8/5/08 12:30:48 PM
Updated by: Reinhard Pötz

A new version has been created, state: publish

Parts
=====

Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 1768 bytes (previous version: 37 bytes)
Content diff:
--- <html><body><p>TODO</p></body></html>
+++ <html>
+++ <body>
+++ 
+++ <p>Cocoon JNet allows the dynamic registration of URLStreamHandler factories
+++ with your JVM. That's a feature that isn't supported by Java itself.</p>
+++ 
+++ <h1>Plain Java usage</h1>
+++ 
+++ <p>The class <tt>org.apache.cocoon.jnet.DynamicURLStreamHandlerFactory</tt> can
+++ be used to install more than one
+++ <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/net/class-use/URLStreamHandlerFactory.html">URLStreamHandlerFactory</a>
+++ and is registered at the JVM by using<tt>
+++ org.apache.cocoon.jnet.URLStreamHandlerFactoryInstaller</tt>.</p>
+++ 
+++ <h1>Spring integration</h1>
+++ 
+++ <p>By using the <a href="daisy:1304">Cocoon Spring-Configurator</a> all beans of
+++ type <tt>java.net.URLStreamHandlerFactory</tt> can be collected:</p>
+++ 
+++ <pre>&lt;bean id="org.apache.cocoon.jnet.URLHandlerFactoryCollector" 
+++   class="org.apache.cocoon.jnet.URLHandlerFactoryCollector"&gt;
+++   &lt;property name="urlHandlerFactories"&gt;
+++     &lt;configurator:bean-map type="java.net.URLStreamHandlerFactory" 
+++       strip-prefix="true" /&gt;
+++   &lt;/property&gt;
+++ &lt;/bean&gt;
+++ </pre>
+++ 
+++ <p>The URLHandlerFactoryCollector is implemented as an around advice. The code
+++ that wants to use the registred protocols only has to be wrapped by this advice.
+++ The Cocoon Servlet-Service framework uses it to intercept all calls of the
+++ service method of any of its servlets:</p>
+++ 
+++ <pre>&lt;aop:config&gt;
+++   &lt;aop:aspect id="installURL" ref="org.apache.cocoon.jnet.URLHandlerFactoryCollector"&gt;
+++     &lt;aop:pointcut id="servletServiceInvocation"
+++       expression="execution(* javax.servlet.Servlet.service(..)) and bean(*/embedded)" /&gt;
+++     &lt;aop:around pointcut-ref="servletServiceInvocation" method="installURLHandlers" /&gt;
+++   &lt;/aop:aspect&gt;
+++ &lt;/aop:config&gt;
+++ </pre>
+++ 
+++ </body>
+++ </html>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.