org.apache.cocoon.components.source
Class URLRewriter

java.lang.Object
  extended by org.apache.cocoon.components.source.URLRewriter
All Implemented Interfaces:
XMLConsumer, ContentHandler, LexicalHandler

public final class URLRewriter
extends Object
implements XMLConsumer

This is an XMLConsumer which rewrites the stream according to the configuration. The configuration can have the following parameters: "rewriteURLMode" : The mode to rewrite the urls. Currently none and cocoon are supported. "cocoonURL" : The url all links are resolved to "urlParameterName" : The parameter name to use for links (all links are then "cocoonURL?urlParameterName=LINK" "baseURL" : The current URL to rewrite

Version:
CVS $Id: URLRewriter.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler

Field Summary
static String MODE_COCOON
           
static String MODE_NONE
           
static String PARAMETER_COCOON_URL
           
static String PARAMETER_MODE
           
static String PARAMETER_PARAMETER_NAME
           
static String PARAMETER_URL
           
 
Constructor Summary
URLRewriter(Parameters configuration, ContentHandler contentHandler)
          Create a new rewriter
URLRewriter(Parameters configuration, ContentHandler contentHandler, LexicalHandler lexicalHandler)
          Create a new rewriter
 
Method Summary
 void characters(char[] ary, int start, int length)
          SAX Event Handling
 void comment(char[] ary, int start, int length)
          SAX Event Handling
 void endCDATA()
          SAX Event Handling
 void endDocument()
          SAX Event Handling
 void endDTD()
          SAX Event Handling
 void endElement(String namespace, String name, String raw)
          SAX Event Handling
 void endEntity(String name)
          SAX Event Handling
 void endPrefixMapping(String prefix)
          SAX Event Handling
 void ignorableWhitespace(char[] ary, int start, int length)
          SAX Event Handling
 void processingInstruction(String target, String data)
          SAX Event Handling
 void setDocumentLocator(Locator locator)
          SAX Event Handling
 void skippedEntity(String name)
          SAX Event Handling
 void startCDATA()
          SAX Event Handling
 void startDocument()
          SAX Event Handling
 void startDTD(String name, String public_id, String system_id)
          SAX Event Handling
 void startElement(String namespace, String name, String raw, Attributes attr)
          SAX Event Handling
 void startEntity(String name)
          SAX Event Handling
 void startPrefixMapping(String prefix, String uri)
          SAX Event Handling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_MODE

public static final String PARAMETER_MODE
See Also:
Constant Field Values

MODE_NONE

public static final String MODE_NONE
See Also:
Constant Field Values

MODE_COCOON

public static final String MODE_COCOON
See Also:
Constant Field Values

PARAMETER_PARAMETER_NAME

public static final String PARAMETER_PARAMETER_NAME
See Also:
Constant Field Values

PARAMETER_URL

public static final String PARAMETER_URL
See Also:
Constant Field Values

PARAMETER_COCOON_URL

public static final String PARAMETER_COCOON_URL
See Also:
Constant Field Values
Constructor Detail

URLRewriter

public URLRewriter(Parameters configuration,
                   ContentHandler contentHandler,
                   LexicalHandler lexicalHandler)
            throws ProcessingException
Create a new rewriter

Throws:
ProcessingException

URLRewriter

public URLRewriter(Parameters configuration,
                   ContentHandler contentHandler)
            throws ProcessingException
Create a new rewriter

Throws:
ProcessingException
Method Detail

setDocumentLocator

public void setDocumentLocator(Locator locator)
SAX Event Handling

Specified by:
setDocumentLocator in interface ContentHandler

startDocument

public void startDocument()
                   throws SAXException
SAX Event Handling

Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
SAX Event Handling

Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
SAX Event Handling

Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
SAX Event Handling

Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String namespace,
                         String name,
                         String raw,
                         Attributes attr)
                  throws SAXException
SAX Event Handling

Specified by:
startElement in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String namespace,
                       String name,
                       String raw)
                throws SAXException
SAX Event Handling

Specified by:
endElement in interface ContentHandler
Throws:
SAXException

characters

public void characters(char[] ary,
                       int start,
                       int length)
                throws SAXException
SAX Event Handling

Specified by:
characters in interface ContentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ary,
                                int start,
                                int length)
                         throws SAXException
SAX Event Handling

Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
SAX Event Handling

Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
SAX Event Handling

Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException

startDTD

public void startDTD(String name,
                     String public_id,
                     String system_id)
              throws SAXException
SAX Event Handling

Specified by:
startDTD in interface LexicalHandler
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
SAX Event Handling

Specified by:
endDTD in interface LexicalHandler
Throws:
SAXException

startEntity

public void startEntity(String name)
                 throws SAXException
SAX Event Handling

Specified by:
startEntity in interface LexicalHandler
Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
SAX Event Handling

Specified by:
endEntity in interface LexicalHandler
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
SAX Event Handling

Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
SAX Event Handling

Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException

comment

public void comment(char[] ary,
                    int start,
                    int length)
             throws SAXException
SAX Event Handling

Specified by:
comment in interface LexicalHandler
Throws:
SAXException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.