You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2005/02/16 18:25:27 UTC
New link rewriting configuration
Hi Lenya devs,
there was an issue with link rewriting:
The XSLT approach matched only canonical URLs of documents,
that's why links with non-canonical URLs were not rewritten.
I created a dedicated class for link rewriting
(o.a.l.cms.publication.util.LinkRewriter) which takes care
of this issue by using the DocumentBuilder to match rewritable
URLs.
This requires a new kind of configuration:
In publication.xconf, you can add a set of
<link-attribute xpath="..."/>
elements to denote rewritable attributes.
For XHTML documents, that would be
<link-attribute xpath="//*[namespace-uri() =
'http://www.w3.org/1999/xhtml']/@href"/>
Unfortunately it is not possible to assign this to the document
type because in 1.2 a task cannot access the document type of a
document. I'll take care of this when porting the functionality
to 1.4.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: New link rewriting configuration
Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Josias Thoeny wrote:
> Thanks, that's really cool. It solves a number of problems.
> May I ask a few questions?
> The DocumentBuilder expects that the URL doesn't contain the context
> prefix (in isDocument() and buildDocument()).
> But in our publication, the internal links contain that prefix. Is that
> normal?
it was unfortunately added when the linkrewriter was first written. the
insert link popups also add it.
> If yes, I think that the context prefix should be stripped away by the
> LinkRewriter, like it's done in LinkRewritingTransformer. (But where to
> get the prefix from?)
agreed http://issues.apache.org/bugzilla/show_bug.cgi?id=31157
> And I think the isDocument() method does not work for external links,
> since it expects the url to start with the publication-id. Maybe there
> should be something like:
>
> if (!url.startsWith("/" + publication.getId())) return false;
>
> at line 162. Otherwise it will throw an exception in some cases.
>
> Another point might be URLs with anchors (foo/bar.html#anchor), or maybe
> request parameters (foo/bar.html?name=value). Should the LinkRewriter
> take care of this?
ideally, yes: http://issues.apache.org/bugzilla/show_bug.cgi?id=29701
--
Gregor J. Rothfuss
COO, Wyona Content Management Solutions http://wyona.com
Apache Lenya http://lenya.apache.org
gregor.rothfuss@wyona.com gregor@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: New link rewriting configuration
Posted by Josias Thoeny <jo...@wyona.com>.
On Wed, 2005-02-16 at 18:25 +0100, Andreas Hartmann wrote:
> Hi Lenya devs,
>
> there was an issue with link rewriting:
>
> The XSLT approach matched only canonical URLs of documents,
> that's why links with non-canonical URLs were not rewritten.
>
> I created a dedicated class for link rewriting
> (o.a.l.cms.publication.util.LinkRewriter) which takes care
> of this issue by using the DocumentBuilder to match rewritable
> URLs.
>
Thanks, that's really cool. It solves a number of problems.
May I ask a few questions?
The DocumentBuilder expects that the URL doesn't contain the context
prefix (in isDocument() and buildDocument()).
But in our publication, the internal links contain that prefix. Is that
normal?
If yes, I think that the context prefix should be stripped away by the
LinkRewriter, like it's done in LinkRewritingTransformer. (But where to
get the prefix from?)
And I think the isDocument() method does not work for external links,
since it expects the url to start with the publication-id. Maybe there
should be something like:
if (!url.startsWith("/" + publication.getId())) return false;
at line 162. Otherwise it will throw an exception in some cases.
Another point might be URLs with anchors (foo/bar.html#anchor), or maybe
request parameters (foo/bar.html?name=value). Should the LinkRewriter
take care of this?
Josias
> This requires a new kind of configuration:
>
> In publication.xconf, you can add a set of
>
> <link-attribute xpath="..."/>
>
> elements to denote rewritable attributes.
> For XHTML documents, that would be
>
> <link-attribute xpath="//*[namespace-uri() =
> 'http://www.w3.org/1999/xhtml']/@href"/>
>
>
> Unfortunately it is not possible to assign this to the document
> type because in 1.2 a task cannot access the document type of a
> document. I'll take care of this when porting the functionality
> to 1.4.
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: New link rewriting configuration
Posted by Andreas Hartmann <an...@apache.org>.
Comiotto Thomas wrote:
>>
>> I created a dedicated class for link rewriting
>> (o.a.l.cms.publication.util.LinkRewriter) which takes care
>> of this issue by using the DocumentBuilder to match rewritable
>> URLs.
>>
>
> Very cool! I'll try to fix rewriting links after moving / pasting node
> trees accordingly if you don't mind..
Yes, that would be great. I'll inform you as soon as the code
is ported to the trunk.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: New link rewriting configuration
Posted by Comiotto Thomas <th...@unicom.unizh.ch>.
>
> I created a dedicated class for link rewriting
> (o.a.l.cms.publication.util.LinkRewriter) which takes care
> of this issue by using the DocumentBuilder to match rewritable
> URLs.
>
Very cool! I'll try to fix rewriting links after moving / pasting node
trees accordingly if you don't mind..
Thanx,
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org