You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by giacomo <gi...@apache.org> on 2001/11/01 12:16:45 UTC
Re: something that bugs me
On Tue, 30 Oct 2001, Stefano Mazzocchi wrote:
> Take a look at this sitemap fragment (used to generate our own docs):
>
> <map:match pattern="*.html">
> <map:aggregate element="site">
> <map:part src="cocoon:/book-{1}.xml"/>
> <map:part src="cocoon:/body-{1}.xml"/>
> </map:aggregate>
> <map:transform src="stylesheets/site2xhtml.xsl">
> <map:parameter name="use-request-parameters" value="true"/>
> <map:parameter name="header" value="graphics/{1}-header.jpg"/>
> </map:transform>
> <map:serialize/>
> </map:match>
>
> <map:match pattern="**/*.html">
> <map:aggregate element="site">
> <map:part src="cocoon:/{1}/book-{1}/{2}.xml"/>
> <map:part src="cocoon:/body-{1}/{2}.xml"/>
> </map:aggregate>
> <map:transform src="stylesheets/site2xhtml.xsl">
> <map:parameter name="use-request-parameters" value="true"/>
> <map:parameter name="header"
> value="{1}/graphics/{2}-header.jpg"/>
> </map:transform>
> <map:serialize/>
> </map:match>
>
> they look so much equal it really bugs me there is no simple way to
> collapse them into one.
>
> What do you think? I know I'm being overly picky but we should make an
> effort to create the most clean sitemaps so that people learn from us.
>
> Also,
>
> <map:match pattern="**images/*.png">
> <map:read src="images/{2}.png" mime-type="image/png"/>
> </map:match>
>
> <map:match pattern="**images/*.jpg">
> <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
> </map:match>
>
> <map:match pattern="**images/*.gif">
> <map:read src="images/{2}.gif" mime-type="image/gif"/>
> </map:match>
>
> could be condensed into
>
> <map:match pattern="**images/*.*">
> <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> </map:match>
>
> assuming that nothing but images are stored there.
I'm not sure but the mime-type attribute is not undergoing variable
replacement so far.
>
> Thinking about it, for those like me who can't learn regexp (sorry, but
> I don't have that mindset), what do you think about adding something
> like
>
> <map:match pattern="**images/*.{gif|jpg|png}">
> <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> </map:match>
You like us to mix wildcard and regex matching?
Giacomo
>
> which prevents curly braces from being used in URI, but it could be
> useful for many to reduce sitemap verbosity by far in many situations.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Berin Loritsch <bl...@apache.org>.
giacomo wrote:
>
> On Tue, 30 Oct 2001, Stefano Mazzocchi wrote:
>
> > Take a look at this sitemap fragment (used to generate our own docs):
> >
> > <map:match pattern="*.html">
> > <map:aggregate element="site">
> > <map:part src="cocoon:/book-{1}.xml"/>
> > <map:part src="cocoon:/body-{1}.xml"/>
> > </map:aggregate>
> > <map:transform src="stylesheets/site2xhtml.xsl">
> > <map:parameter name="use-request-parameters" value="true"/>
> > <map:parameter name="header" value="graphics/{1}-header.jpg"/>
> > </map:transform>
> > <map:serialize/>
> > </map:match>
> >
> > <map:match pattern="**/*.html">
> > <map:aggregate element="site">
> > <map:part src="cocoon:/{1}/book-{1}/{2}.xml"/>
> > <map:part src="cocoon:/body-{1}/{2}.xml"/>
> > </map:aggregate>
> > <map:transform src="stylesheets/site2xhtml.xsl">
> > <map:parameter name="use-request-parameters" value="true"/>
> > <map:parameter name="header"
> > value="{1}/graphics/{2}-header.jpg"/>
> > </map:transform>
> > <map:serialize/>
> > </map:match>
> >
> > they look so much equal it really bugs me there is no simple way to
> > collapse them into one.
I tried, and I couldn't do it. It has to do with the way the aggregation
calls are made.
If the match to "**/book-*.xml" could be fixed, then it might work.
> >
> > What do you think? I know I'm being overly picky but we should make an
> > effort to create the most clean sitemaps so that people learn from us.
> >
> > Also,
> >
> > <map:match pattern="**images/*.png">
> > <map:read src="images/{2}.png" mime-type="image/png"/>
> > </map:match>
> >
> > <map:match pattern="**images/*.jpg">
> > <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
> > </map:match>
> >
> > <map:match pattern="**images/*.gif">
> > <map:read src="images/{2}.gif" mime-type="image/gif"/>
> > </map:match>
> >
> > could be condensed into
> >
> > <map:match pattern="**images/*.*">
> > <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> > </map:match>
> >
> > assuming that nothing but images are stored there.
>
> I'm not sure but the mime-type attribute is not undergoing variable
> replacement so far.
For Jpegs, this would yield the following Mime type that is not
the most correct, but recognized by many clients: "image/jpg".
We would have to change the name of all Jpeg images to use the
".jpeg" extension instead. That's one reason.
> > Thinking about it, for those like me who can't learn regexp (sorry, but
> > I don't have that mindset), what do you think about adding something
> > like
> >
> > <map:match pattern="**images/*.{gif|jpg|png}">
> > <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> > </map:match>
>
> You like us to mix wildcard and regex matching?
-1. If you are going to restrict patterns, regex is very powerful,
and I don't like mixing metaphores here. In regex, the above
could be written as:
<map:match pattern=".*images\/.*\.(gif|jpg|png)">
<map:read src="images/{2}.gif" mime-type="image/{3}"/>
</map:match>
or something like that. I'm not a RegExp GURU in the least. It _is_
very useful when you are validating complex entries like email addresses
and such.
>
> Giacomo
>
> >
> > which prevents curly braces from being used in URI, but it could be
> > useful for many to reduce sitemap verbosity by far in many situations.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
--
"Those who would trade liberty for
temporary security deserve neither"
- Benjamin Franklin
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Stefano Mazzocchi <st...@apache.org>.
Sebastien Koechlin wrote:
>
> Stefano Mazzocchi wrote:
> >
> > giacomo wrote:
> >
> > > > Thinking about it, for those like me who can't learn regexp (sorry, but
> > > > I don't have that mindset), what do you think about adding something
> > > > like
> > > >
> > > > <map:match pattern="**images/*.{gif|jpg|png}">
> > > > <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> > > > </map:match>
> > >
> > > You like us to mix wildcard and regex matching?
> >
> > Matchers are pluggable anyway.
> >
> > But it's not a real issue, forget about it.
>
> We can have a file to do default mapping of mime-type depending on
> file extension.
>
> file:/etc/mime.types
What do you mean?
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Sebastien Koechlin <sk...@ivision.fr>.
Stefano Mazzocchi wrote:
>
> giacomo wrote:
>
> > > Thinking about it, for those like me who can't learn regexp (sorry, but
> > > I don't have that mindset), what do you think about adding something
> > > like
> > >
> > > <map:match pattern="**images/*.{gif|jpg|png}">
> > > <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> > > </map:match>
> >
> > You like us to mix wildcard and regex matching?
>
> Matchers are pluggable anyway.
>
> But it's not a real issue, forget about it.
We can have a file to do default mapping of mime-type depending on
file extension.
file:/etc/mime.types
--
Sébastien Koechlin - IVision - skoechlin@ivision.fr
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Giacomo Pati <gi...@apache.org>.
Quoting Sebastien Koechlin <sk...@ivision.fr>:
> I did not receive any answer about my last message about this.
>
> > <map:match pattern="**images/*.png">
> > <map:read src="images/{2}.png" mime-type="image/png"/>
> > </map:match>
> >
> > <map:match pattern="**images/*.jpg">
> > <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
> > </map:match>
> >
> > <map:match pattern="**images/*.gif">
> > <map:read src="images/{2}.gif" mime-type="image/gif"/>
> > </map:match>
>
> What about
>
> <map:match pattern="**images/*">
> <map:read src="images/{2}"/>
> </map:match>
>
> with the help of a file to map content-type according to
> filename extention ?
>
> Is it possible to use a mapping when the mime-type attribute
> does not exist ?
There is a getMimeType method specified in the SitemapOutputComponent (which
Readers extend). This method is the most accepted mime-type to be used by the
engine. If this returns null (as the default implementation does) next in the
chain is the mime-type attribute specified at the map:read element in the
sitemap. If even there isn't a mime-type specified the one mentioned in the
component definition (<map:reader name="..." mime-type="..." src="..."/> is
take. This procedure is used for Serializers as well.
Giacomo
>
> Such mapping is already written in xml form in
> $TOMCAT_HOME/conf/web.xml
>
> --
> Sébastien Koechlin - IVision - skoechlin@ivision.fr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Giacomo Pati <gi...@apache.org>.
Quoting Sylvain Wallez <sy...@anyware-tech.com>:
> Sebastien Koechlin a écrit :
> >
> > I did not receive any answer about my last message about this.
> >
> > > <map:match pattern="**images/*.png">
> > > <map:read src="images/{2}.png" mime-type="image/png"/>
> > > </map:match>
> > >
> > > <map:match pattern="**images/*.jpg">
> > > <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
> > > </map:match>
> > >
> > > <map:match pattern="**images/*.gif">
> > > <map:read src="images/{2}.gif" mime-type="image/gif"/>
> > > </map:match>
> >
> > What about
> >
> > <map:match pattern="**images/*">
> > <map:read src="images/{2}"/>
> > </map:match>
> >
> > with the help of a file to map content-type according to
> > filename extention ?
> >
> > Is it possible to use a mapping when the mime-type attribute
> > does not exist ?
> >
> > Such mapping is already written in xml form in
> > $TOMCAT_HOME/conf/web.xml
> >
>
> This is already how Cocoon works !
>
> If you don't specify a mime-type in map:read, the ResourceReader asks
> the environment context for a mime type for the resource using
> getMimeType(). This method uses the builtin mime type definitions of the
> servlet container and those defined in web.xml to search for an
> appropriate mime type.
Yes, you are right. I've forgot to mention this one.
Giacomo
>
> Sylvain.
>
> > --
> > Sébastien Koechlin - IVision - skoechlin@ivision.fr
> >
>
> --
> Sylvain Wallez
> Anyware Technologies - http://www.anyware-tech.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Sebastien Koechlin a écrit :
>
> I did not receive any answer about my last message about this.
>
> > <map:match pattern="**images/*.png">
> > <map:read src="images/{2}.png" mime-type="image/png"/>
> > </map:match>
> >
> > <map:match pattern="**images/*.jpg">
> > <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
> > </map:match>
> >
> > <map:match pattern="**images/*.gif">
> > <map:read src="images/{2}.gif" mime-type="image/gif"/>
> > </map:match>
>
> What about
>
> <map:match pattern="**images/*">
> <map:read src="images/{2}"/>
> </map:match>
>
> with the help of a file to map content-type according to
> filename extention ?
>
> Is it possible to use a mapping when the mime-type attribute
> does not exist ?
>
> Such mapping is already written in xml form in
> $TOMCAT_HOME/conf/web.xml
>
This is already how Cocoon works !
If you don't specify a mime-type in map:read, the ResourceReader asks
the environment context for a mime type for the resource using
getMimeType(). This method uses the builtin mime type definitions of the
servlet container and those defined in web.xml to search for an
appropriate mime type.
Sylvain.
> --
> Sébastien Koechlin - IVision - skoechlin@ivision.fr
>
--
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Sebastien Koechlin <sk...@ivision.fr>.
I did not receive any answer about my last message about this.
> <map:match pattern="**images/*.png">
> <map:read src="images/{2}.png" mime-type="image/png"/>
> </map:match>
>
> <map:match pattern="**images/*.jpg">
> <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
> </map:match>
>
> <map:match pattern="**images/*.gif">
> <map:read src="images/{2}.gif" mime-type="image/gif"/>
> </map:match>
What about
<map:match pattern="**images/*">
<map:read src="images/{2}"/>
</map:match>
with the help of a file to map content-type according to
filename extention ?
Is it possible to use a mapping when the mime-type attribute
does not exist ?
Such mapping is already written in xml form in
$TOMCAT_HOME/conf/web.xml
--
Sébastien Koechlin - IVision - skoechlin@ivision.fr
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Sebastien Koechlin <sk...@ivision.fr>.
Stefano Mazzocchi wrote:
>
> giacomo wrote:
>
> > > Thinking about it, for those like me who can't learn regexp (sorry, but
> > > I don't have that mindset), what do you think about adding something
> > > like
> > >
> > > <map:match pattern="**images/*.{gif|jpg|png}">
> > > <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> > > </map:match>
> >
> > You like us to mix wildcard and regex matching?
>
> Matchers are pluggable anyway.
We can have a file to do default mapping of mime-type depending on
file extension.
<map:readers default="resource">
<map:reader name="resource"
src="org.apache.cocoon.reading.ResourceReader">
<file type="unix" href="file:/etc/mime.types"/>
</map:reader>
</map:readers>
or
<map:readers default="resource">
<map:reader name="resource" src="">
<file type="xml" src="WEB-INF/mime-types.xml"/>
</map:reader>
</map:readers>
With mime-types.xml looking like :
<mime type="application/pdf"> pdf </mime>
<mime type="application/postscript"> ai,eps,ps </mime>
And then use :
<map:match pattern="**images/*">
<map:read src="images/{2}"/>
</map:match>
no more mime-type attribute, org.apache.cocoon.reading.ResourceReader
will use
the file to map mime-type using the file extension.
--
Sébastien Koechlin - IVision - skoechlin@ivision.fr
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: something that bugs me
Posted by Stefano Mazzocchi <st...@apache.org>.
giacomo wrote:
> > Thinking about it, for those like me who can't learn regexp (sorry, but
> > I don't have that mindset), what do you think about adding something
> > like
> >
> > <map:match pattern="**images/*.{gif|jpg|png}">
> > <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> > </map:match>
>
> You like us to mix wildcard and regex matching?
Matchers are pluggable anyway.
But it's not a real issue, forget about it.
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org