cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: [proposal] some changes to SourceResolver.resolve(baseURI,location, params)
Date Mon, 26 May 2003 10:12:43 GMT
Hi Bruno,

your proposal makes sense and it looks good. I see only a minor
problem, the source resolver code is released as 1.0, so we
should perhaps find a way to apply the changes without getting
incompatible.
If I'm right, the only real incompatible change would be the
SourceFactory interface - so if this can still be kept compatible
perhaps by using a "new ExtendedSourceFactory" interface it
would be great.

What do you think?

Carsten

Bruno Dumon wrote:
> Hi,
> 
> you may or may not have noticed some discussing going on about relative
> to absolute URL resolving, i.e. making an absolute URL based on a
> baseURI and some location (lets call this process "absolutizing"). This
> mostly happend in bug 20088 [1].
> 
> The conclusion was that since the format of the URL data following the
> scheme name is scheme specific, it is only the implementation of the
> Source(Factory) that can rightfully know if and how relative URL
> resolving is possible. See also the problem with the cocoon and context
> schemes where the authority part is actually a part of the path.
> 
> Therefore, I propose to move the absolutizing code out of
> SourceResolverImpl.resolveURI(location, baseURI, params) and into a new
> method SourceFactory.resolveURI(location, baseURI, params), to be
> implemented by each source factory. The method
> SourceResolver.resolveURI(...) will continue to exist, but will now have
> more of a dispatch function (see below).
> 
> Additionally, the current implementation of the SourceResolverImpl does
> not do the absolutizing very well. For example, given the location
> "../otherfile.xml" and the baseURI
> "http://localhost:8080/dir1/dir/file.xml", it will absolutize this to
> "http://localhost:8080/dir1/dir/file.xml/../otherfile.xml".
> 
> I have already the utility code ready to do correct absolutizing both
> for "normal" URLs and for the cocoon and context cases, so it is mainly
> a matter of integrating it into the current sourceresolver.
> 
> The new algorithm for SourceResolverImpl.resolve would become:
> 
> Given the input parameters baseURI and location:
> 
> 0. special file trickery: (as done in the current implementation)
>    if location.charAt(1) == ':"
>      then location = "file:/" + location
>    if (location.charAt(0) == '/' and location.charAt(2) == ':')
>      then location = "file:" + location
> 
> 1. determine scheme:
>      - if the scheme of the location is not empty, use that
>      - otherwise use the scheme of the baseURI (it is an error
>        for baseURI not to have a scheme)
> 
> 2. use the scheme to lookup the SourceFactory
> 
> 3. do SourceFactory.createSource(location, baseURI, params)
> 
> Thoughts? Everyone ok with this?
> 
 

Mime
View raw message