cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject BlockContextURLConnection is not context safe
Date Tue, 18 Sep 2012 21:57:29 GMT
Hi all,

I am working on COCOON3-105 whenever I find a sec, but I am thinking 
about the underlying problem for a while now.

To resume, the blockcontext:/ is being registered as an extension to In case of a not-known protocol we will create 
the StreamHandler (who is responsible to open the urlConnection) once - 
for the whole container!

This happens in the BlockContextURLStreamHandlerFactory in the method 
createURLStreamHandler(String protocol). Like said: only once (!) we 
call this method even if we have two different servlets using different 
blockcontext. This finally leads to that the BlockContextURLConnection 
only knows the blockcontext of the first requested blockcontext and 
ignores any others.

Some possible solution I see:
- move the resolving of the blockcontext into the 
BlockContextURLConnection. I tried that in the patch I attached to the 
issue but the problem is that the second request has no ServletContext 
associated to it so we cannot get the blocks. -> since we cannot resolve 
here the blockcontext this solution does not work
- use a global blockcontext map. A reference to a global blockcontext 
map will be kept and this map needs to be merged when a new app is 
deployed (if needed). However that leads to many open issue like 
security, version, etc.

Further how do you undeploy the protocol since undeploying the 
underlying servlet would need to undeploy only a part of the 
blockcontext protocol.

I am not sure how to overcome above obstacles and would love any 
thoughts from the community.


Thorsten Scherler <>
codeBusters S.L. - web based systems
<consulting, training and solutions>

View raw message