I'm curious about the possibility to alter href
attributes of all generated links.
Let's assume I have a web page which looks something like this:
<div>
<h:link outcome="/foo.xhtml" value="a link" />
...
<h:link outcome="/bar.xhtml" value="another link" />
</div>
The resulting output would be something like this:
<div>
<a href="/foo.jsf">a link</a>
...
<a href="/bar.jsf">another link</a>
</div>
I'm now trying to alter the URL generated as href
attribute within the generated content and let's say add a directory to all the generated links (depending on their content), so that I get the output
<div>
<a href="/a-new-location/foo.jsf">a link</a>
...
<a href="/another-new-location/bar.jsf">another link</a>
</div>
Is there a quick and easy way to achieve this or do I have to implement the component and the renderer completely on my own and copy the logics used by the standard implementation?
just a quick note to let you know that I solved the problem by replacing the standard ViewHandler
with my own ViewHandler
implementation that overrides the getBookmarkableURL
method and performs the replacement upon the URL generated by the parent ViewHandler
.