You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Timm, Sean" <ST...@mailgo.com> on 2000/01/23 09:00:58 UTC

Non-cocoon files and relative path issues (plus bonus ServletExec 2.2 bug!)

I believe I now understand why I was having an issue with images and
relative paths, and now I'm trying to determine the best solution to handle
the problem.

If I hit Cocoon through http://MyWebServer/servlet/Cocoon/MySite/index.xml,
and the resultant HTML spits out image links with src="images/Image.gif",
the browser will attempt to load the graphic through
http://MyWebServer/servlet/Cocoon/MySite/images/Image.gif.  Cocoon, of
course, tries to process this graphic as a Cocoon file and returns an error,
and I don't get my graphic.  This sucks.  The only way I know of to get it
to work through this access method is to refer to the images as a full path
like /MySite/images/Image.gif.  Of course, this makes it significantly
harder to move a site around.  I realize that one shouldn't be moving sites
around, but we are developing sites for various customers.  I'd like the
flexibility to keep all of our stuff together and be able to install it
however the customer would like.

My next thought was that I could map an alias in ServletExec to point *.xml
to the Cocoon processor.  This way, I could access my files through the
standard path, and only the XML files would get sent to Cocoon.  At this
point, I ran into a bug in ServletExec which I posted on the ServletExec
mailing list (hopefully I'll get a response).  The problem is that
ServletExec returns the call to request.getRealPath(request.getRequestURI())
differently depending on whether I accessed it through the
servlet/Cocoon/MySite/index.xml method or the /MySite/index.xml mapped to an
alias method.  ServletExec returns the same path, except the slashes are
reversed.  Cocoon is only looking for the forward slashes, so it fails to
parse the path if I access it with /MySite/index.xml. This, too, sucks.
I'll send a patch separately that handles this until NewAtlanta fixes the
problem.

This led me to thinking about what I've been reading about Cocoon 2.  How is
it going to handle all of these files it isn't familiar with?  I got the
impression that I could just hit a bunch of different URIs with it, but this
won't work if it doesn't handle the files it doesn't recognize differently,
or am I missing something (entirely possible)?

Thanks,
Sean T.