cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject Re: [jira] Created: (COCOON-2154) Servlet:/ protocol: Support absolute URIs
Date Fri, 28 Dec 2007 01:20:18 GMT
Joerg Heinicke pisze:
> Could anybody please sum up what the actual problem is and what the
> proposals are to solve it? So far I only got that there is an issue with
> cache key which can be solved by absolutizing URIs. Now there is this
> relative vs. absolute URI thing. What for do we need the +? What's the
> scheme for relative URIs?

Yeah, sure. Little bit background on caching issue:

Currently ServletSource.getURI() method returns relative URIs that look like this:


Where connect_name is name of connection to another servlet that is defined locally in a given
servlet. If it's omitted then it means that URI references to the current servlet. The conclusion
that URIs of that form are relative to the servlet they are resolved in. E.g. servlet A can
to servlet C with connection name "foo", and servlet B can connect to servlet D with connection
"foo" as well. Then in servlet A URI:


point to completely different resource than the same URI in servlet B. We came to conclusion
the best way to absolutize URIs is to replace connection name (that is local to the given
with servlet ID (more precisely, Spring bean ID) that is unique in whole application. Then
if we
absolutize URI from example above being in servlet A it would look like:


and in servlet B the same URI would look like:


The only problem is that we have no way to check if given URI contains connection name or
ID. Therefore the idea to add special sign that would remove the ambiguousness appeared. Current
proposal are:
a) add a plus sign after servlet ID (by Reinhard)
b) add a exclamation mark at the very beginning of the path (by Vadim)

My personal preference is a plus sign but as Reinhard already pointed out it does not matter
much because we usually won't be using absolute URIs directly.

                                                 -- o0o --

Now it's the time to give some description of static connection list problem. Currently one
define list of connection of a given servlet statically in XML config. If you compile a block
is no chance to add new connections to other servlets. Now, imagine situation that you have
application making charts and you create separate block (and servlet) for each datasource
For example, you create block that extracts some data from database and second one that extracts
some data from mailbox. If you want to pull this data, you need to connect to these two blocks
course so you add them to your local connection list.
Now you can compile your application and everything will be working fine. But what if you
want to
define another datasource for your charts, for example data from some web service? Of course
develop a new block that downloads and transforms interesting data but you need a way to inform
appliction that there is a third block. The most obvious way is to add connection to the third
but this involves recompilation of your application!

The solution that I and Reinhard (and probably others) have in mind is to let servlet use
URIs so you don't need to define connections statically to other block. There would be also
discovery mechanism of available blocks, probably a generator, that would return you a list
blocks fulfilling particular needs. The list would contain servlet ID of each servlet (block)
so you
could reference them later on.

I hope this helps you a little bit.

Grzegorz Kossakowski

View raw message