Links within "IMG" and "FORM" tags are not rewritten (in contrast to links within "A" tags)


In order to enhance the rewriting pipeline, you can do so by implementing a custom RewriterTransformerFactory [1]. This is an optional component used to extend the existing rewriting mechanism. Such a RewriterTransformerFactory must provide a Transformer [2] implementation through which the html to be rewritten passes as SAX events. In order to ease the implementation of custom rewriter transformers, an AbstractContentHandler [3] class is available for extension which provides default implementations of methods specified by the org.xml.sax.ContentHandler interface.

An example skeleton could look like this:

package x.y.z;
* @scr.component metatype="no"
* @scr.service
* name="service.ranking" value="-100" type="Integer"
public class MyRewriterTransformer extends AbstractContentHandler
               implements RewriterTransformerFactory, Transformer {

  // override startElement method
  public void startElement(String uri, String loc, String raw, Attributes a)
               throws SAXException {

      // implement your custom link rewriting here

  public Transformer createTransformer() {
      return new MyRewriterTransformer();

Please note that the value of the service-ranking influences the order when this rewriting transformer will be triggered. See [1] for more details on that.

Applies To

CQ 5.2.x




Esta obra está licenciada sob uma licença não adaptada da Creative Commons Attribution-Noncommercial-Share Alike 3.0  As publicações do Twitter™ e do Facebook não são cobertas pelos termos do Creative Commons.

Avisos legais   |   Política de privacidade online