Hugh Sparks asks:
[...As of cocoon-core-2.2.1-SNAPSHOT...]
The SitemapServlet doesn't seem to like the context-path set to "/"
Is there some protocol I should use "xxx:/" to start the webapp with
the context at root?

Grzegorz Kossakowski replies:
Hugh, just to make sure that we understand context-path parameter the same way: context-path tells SitemapServlet what's the base path against which all relative paths used in sitemap are resolved.

Yes. I understand. But I would expect the class SitemapServlet to know about
the directory where the sitemap is located in the webapp. Or at least have some
default directory relative to the servlet container.

To clarify what I'm trying to do: I'm adding a sitemap and content directly to a
webapp created using the webapp archetype. I then add a SitemapServlet
bean to the spring configuration file in the WEB-INF. It is a strategy for migrating a large cocoon 1.x site to cocoon 2.2. This has worked for about one year, but I keep testing with recent checkouts from the trunk and it stopped working in the
last week or two.

If you are really sure that it must be "/" (which is quite surprising to me) you probably need to use file: protocol, so just put file:/// into context-path.

Well, it used to be "/", but now using the file protocol as you suggest make it happier:
On Windows, the file protocol takes you to the top of the C drive:

org.apache.excalibur.source.SourceNotFoundException: file:///C:/sitemap.xmap doesn't exist.

I also tried "blockcontext://" with no block name:

   org.apache.avalon.framework.configuration.ConfigurationException:
       Cannot resolve blockcontext:/sitemap.xmap

Using the absolute path to the target sitemap directory works:

context-path=
   "file:///C:/Documents and Settings/Administrator/My  Documents/
   Projects/Cocoon/Experiments/Test/target/cocoon22-1.0/"

But that is absurd. The context-path would have to be changed and
the webapp rebuilt whenever it is deployed to a different directory.

Is there some parameteter that could be used that would resolve
to the right place when the servlet starts? For example:

     context-path="file:/{$some.spring.thing}/"

In the configuration for the maven-jetty-plugin, there are elements
for webAppSourceDirectory and contextPath. Shouldn't these settings
have some effect on where the context-path for the SitemapServlet looks
when it is a relative path? (Forgive me if this makes no sense. I'm still
trying to figure out how jetty and spring interact.)

As I mentioned before, this is a very recent change.Using "/" in
cocoon 2.2.0 and all previous snapshots made the context-path
point to the directory that contains the sitemap. This seems like
the right behavior to me.

With 2.2.1, it seems there is no way to set the servlet context to the
directory that contains the sitemap unless blocks are used. This seems
to be a needless restriction.

Perhaps this change in cocoon 2.2.1 should count as a bug?
I would very much like to convince someone to put this back
the way it was. But I suppose there must have been some motivation
other than making it impossible to use cocoon without adding
content to a new block.

If this change was not an accident, Maybe there should be a
new protocol,  "servletcontext:/" to allow context-path to be set to a
location relative to the servlet deployment directory?

I browsed though the cocoon-core svn logs, but I can't find the change
that introduced this behavior. I don't see any changes to SitemapServlet
or files in the surrounding directory that seem recent enough.

I am tempted to cross-post this issue to cocoon-dev. Is that appropriate?

Thanks,

-Hugh Sparks, [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to