On Fri, 2008-04-25 at 17:31 +0100, Milan Ježdík wrote:
> According to this: http://solprovider.com/lenya/variableshowto I am able
> to put the parameters into my page (ad 1). Using
> {page-envelop:document-url-without-language}.
>
> I still don't know how to convert special chars into HEX entities (ad
> 2). So I still need help with creating the encoded article URL for
> bookmark services (Exactly how to produce this:
> http%3A%2F%2Flenya.apache.org%2Fscreenshots.html
> from this:
> http://lenya.apache.org/screenshots.html ?
Hmm, why you need it so verbose?
>
> I was thinking about using XSP to do this but I am afraid about the site
> performance.
I would create a small java helper class that is doing the conversion
(URLHexEncoder.java#encode(string)), then you can write an input module
that is using the helper to calculate the url encoding and/or using it
from a jx page.
URLHexEncoder.java
public class URLHexEncoder {
public static String encode(String url){
String resultUrl = null;
//calculate your resultUrl and then
return resultUrl;
}
}
However there is org.apache.cocoon.util.NetUtils that may offer already
the decode/encode functionality you are looking for.
Then from an input module (URLHexEncoderModule.java)
public class URLHexEncoderModule extends AbstractInputModule {
public Object getAttribute(String name, Configuration modeConf, Map
objectModel) throws ConfigurationException {
return URLHexEncoder.encode(name);
}
}
or from jx
<jx:set var="hexUrl"
value="${Packages.your.path.URLHexEncoder("URL")}"/>
HTH
salu2
>
> M.
>
>
>
> Milan Ježdík wrote:
> > Hello,
> >
> > I would like to have "Share me" box on each article. This box will
> > contain a list of links to bookmark services such as digg, facebook,
> > delicious, etc. directly bookmarking this article. (example:
> > http://digg.com/submit?phase=2&url=http%3A%2F%2Flenya.apache.org%2Fscreenshots.html&title=Lenya+Apache+org)
> >
> >
> >
> >
> > Questions:
> > 1) How can I achieve this?
> > 2) How can I convert special chars into HEX encoding? Eg. ':' -> %3A '/'
> > -> %2F, etc.
> >
> > I was thinking about using variables such
> > {page-envelope:context-prefix}. I just don't know if I can use (and
> > how/where) these in XSL templates.
> >
> > Is this possible with changes only in XSL templates under xslt directory
> > or it needs some xmap changes?
> >
> > Any help appreciated.
> >
> > Thanks,
> > Milan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]