01: /* Copyright 2002 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.utils;
07:
08: import org.xml.sax.Attributes;
09: import org.xml.sax.ContentHandler;
10: import org.xml.sax.SAXException;
11: import org.xml.sax.helpers.AttributesImpl;
12:
13: /**
14: * Replaces all relative URLs with absolute URLs in
15: * a WML document
16: * @author Ken Weiner, kweiner@unicon.net
17: * @version $Revision: 34796 $
18: */
19: public class WMLURLFilter extends AbsoluteURLFilter {
20:
21: /**
22: * A constructor which receives a ContentHandler to which
23: * filtered SAX events are passed
24: * @param handler the ContentHandler to which filtered SAX events are passed
25: */
26: protected WMLURLFilter(ContentHandler handler) {
27: super (handler);
28: }
29:
30: public void startElement(String uri, String localName,
31: String qName, Attributes atts) throws SAXException {
32: AttributesImpl attsImpl = new AttributesImpl(atts);
33: // This is an initial guess at what needs to be fixed...more may be needed!
34: fixURL("img", "src", qName, atts, attsImpl);
35: fixURL("a", "href", qName, atts, attsImpl);
36: fixURL("go", "href", qName, atts, attsImpl);
37: super.startElement(uri, localName, qName, attsImpl);
38: }
39: }
|