cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <KPiroum...@flagship.ru>
Subject Re: More sitemap magic, what about css files?
Date Thu, 08 Nov 2001 17:07:18 GMT
If "app" is your webapp context path then everything that I've said remains
the same. The browser sees your page as http://<host>/app/file.xml and sends
request to <path-except-file> + "main-style.css" =
http://<host>/app/main-style.css, then this request is dispatched to C2 and
it get it as a request to the contextRoot = "/main-style.css", so although,
your real *css files are in a subdirectory, but the request is matched by
the "*.css" pattern.

In my case, if have a deeper request hierarchy:
http://<host>/app/customer/process/action/file.xml - href to css file
results in a request like: http://<host>/app/customer/process/action/ and is
dispatched to C2 as: "/customer/process/action/style.css" - this is not
matched by "*.css" pattern, but by the "**/*.css":
{1} = /customer/process/action
{2} = style.css

 So, no matter how deep is request structure I get all requests to *.css
files and serve them from my /css directory in the application root. I use
the same approach also for my images.

Konstantin

----- Original Message -----
From: "Luca Morandini" <l.moran@tin.it>
To: <cocoon-users@xml.apache.org>
Sent: Thursday, November 08, 2001 7:25 PM
Subject: RE: More sitemap magic, what about css files?


Konstantin,

I'm sure it works. I've taken thoso snippets from a working website.

Hence, I think the matter should be investigated further.

To clarify things:
1) My XML files are in <host>\app\docs
2) My CSS files are in <host>\app\styles
3) I use Cocoon 2.0rc1, Tomcat 3.2.3, JRE 1.3.1, IIS 5.0, Windows 2000
Professional SP2.

Hence, http://<host>/app/file.xml is read from <host>\app\docs\file.xml and
rendered as an HTML containing href="main-style.css", which is in turn
retrieved by Cocoon from <host>\app\styles\main-style.css

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Piroumian, Konstantin [mailto:KPiroumian@flagship.ru]
> Sent: Thursday, November 08, 2001 5:03 PM
> To: cocoon-users@xml.apache.org
> Subject: Re: More sitemap magic, what about css files?
>
>
> This doesn't work (maybe this has been fixed already?) in case, when your
> referring file is in a subdirectory:
> http://<host>/level1/level2/file.xml
>
> href="main-style.css" will result in
> http://<host>/level1/level2/main-style.css request from browser -
> this won't
> be processed by "*.css" matcher.
>
> I use this combination:
>
> <!-- this will match any <dir>/*.css request -->
> <map:match pattern="**/*.css">
>     <map:read src="styles/{2}.css" mime-type="text/css"/>
> </map:match>
>
> <!-- this will match any /*.css request -->
> <map:match pattern="*.css">
>     <map:read src="styles/{1}.css" mime-type="text/css"/>
> </map:match>
>
> Regards,
>     Konstantin Piroumian
>
> ----- Original Message -----
> From: "Luca Morandini" <l.moran@tin.it>
> To: <cocoon-users@xml.apache.org>
> Sent: Thursday, November 08, 2001 6:34 PM
> Subject: RE: More sitemap magic, what about css files?
>
>
> Soren,
>
> I simply use this in the sitemap (of course I have a "styles" directory):
>
> <map:match pattern="*.css">
> <map:read src="styles/{1}.css" mime-type="text/css"/>
> </map:match>
>
> and this in the HTML:
>
> <link href="main-style.css" rel="stylesheet" type="text/css">
>
> and it works.
>
> Though an error is signaled by Tomcat... and it was reported by
> other users
> last week... this error is suspicious, but, apparently, harmless.
>
> Best regards,
>
> ---------------------------------------------
>                Luca Morandini
>                GIS Consultant
>               lmorandini@ieee.org
> http://utenti.tripod.it/lmorandini/index.html
> ---------------------------------------------
>
>
> > -----Original Message-----
> > From: Søren Neigaard [mailto:s.neigaard@mobilethink.dk]
> > Sent: Friday, November 09, 2001 1:28 AM
> > To: cocoon-users@xml.apache.org
> > Subject: More sitemap magic, what about css files?
> >
> >
> > It's like my css files aren't returned by my server, as if C2 wants to
> > process them instead. If I try to hit a css file directly via my browser
> > (and I know it's there), I get a blank page!??? Do I have to
> > instruct C2 to
> > return those css files without even looking at them? How do I do this
> > smartest?
> >
> > One thing I like in the sitemap, is the posibility to fake the
> DocumenRoot
> > (look beneath).
> >
> > Real DocumentRoot (set by application server) = /project/
> >
> > With following sitemap:
> > --------------------
> > <map:match pattern="*.xml">
> >  <map:generate type="serverpages" src="client/media_pc/pages/{1}.xml"/>
> >  <map:transform type="xslt" src="client/media_pc/pages/{1}.xsl"/>
> >  <map:serialize/>
> > </map:match>
> > --------------------
> >
> > Gives:
> > --------------------
> > http://host/test.xml -> /project/client/media_pc/pages/test.xml
> > --------------------
> >
> > But what if the generated HTML has a relative URL to it's CSS, like
> > "../css/test.css", and this CSS file really is in
> > "/project/client/media_pc/css/test.css"? What to do then? The
> > page thinks it
> > is on root of server, so "../" would go beneath DocumentRoot
> and that wont
> > work. What would you guys do here?
> >
> > Med venlig hilsen/Best regards
> > Søren Neigaard
> > System Architect
> > ................................
> > Mobilethink A/S
> > Arosgaarden
> > Åboulevarden 23, 5.sal
> > DK - 8000 Århus C
> > Telefon: +45 86207800
> > Direct: +45 86207810
> > Fax: +45 86207801
> > Email: s.neigaard@mobilethink.dk
> > Web: www.mobilethink.dk
> > ................................
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> > For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> >
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message