cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francesco Chicchiriccò <ilgro...@apache.org>
Subject Re: BlockContextURLConnection is not context safe
Date Thu, 20 Sep 2012 06:37:28 GMT
On 19/09/2012 18:30, Reinhard Pötz wrote:
> On 09/19/2012 03:17 PM, Francesco Chicchiriccò wrote:
>> Anyway, what if we try to use cocoon-jnet [2] for handling
>> blockcontext:// ? AFAIK it is only used for servlet:// ATM.
>
> JNet was my first thought too ...

I am actually having some troubles in understanding how JNet works.

I've made some modifications to cocoon-block-deployment trunk, basically:
 * removed [1] so that BlockContextURLStreamHandlerFactory does not get
automatically installed
 * modified BlockContextURLStreamHandlerFactory [2] so that blockContext
map is not got through Spring but provided via constructor
 * modified BlockDeploymentServletContextListener [3] to use JNet in the
following way, in contextInitialized(), after getting the blockContext map:

 DynamicURLStreamHandlerFactory.push(new
BlockContextURLStreamHandlerFactory(this.blockContexts));

For my understanding of JNet, this should mean that, since
DynamicURLStreamHandlerFactory is already installed for webapps by
org.apache.cocoon.jnet.URLHandlerFactoryCollector (for servlet://),
there is a ThreadLocal list of URLStreamHandlerFactory containing the
BlockContextURLStreamHandlerFactory instantiated by
BlockDeploymentServletContextListener as above.

Hence - always for my understanding - every thread should have its own
list of URLStreamHandlerFactor; as a result, two separate C3 webapps in
the same container should resolve blockcontext:// URLs according to two
different and separate blockContext maps.

...but this has proven to be failing :-)

Any thought?

[1]
https://svn.apache.org/repos/asf/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-protocol.xml
[2]
https://svn.apache.org/repos/asf/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandlerFactory.java
[3]
https://svn.apache.org/repos/asf/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockDeploymentServletContextListener.java

-- 
Francesco Chicchiriccò

ASF Member, Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/


Mime
View raw message