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.channels.webproxy;
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: * Rewrites URLs for CWebProxy in a WML document.
15: * @author Sarah Arnott, sarnott@mun.ca
16: * @version $Revision: 34756 $
17: */
18: public class CWebProxyWMLURLFilter extends CWebProxyURLFilter {
19:
20: /**
21: * A constructor which receives a ContentHandler to which
22: * filtered SAX events are passed.
23: * @param handler the ContentHandler to which filtered SAX events are passed
24: */
25: public CWebProxyWMLURLFilter(ContentHandler handler) {
26: super (handler);
27: }
28:
29: public void startElement(String uri, String localName,
30: String qName, Attributes atts) throws SAXException {
31: AttributesImpl attsImpl = new AttributesImpl(atts);
32:
33: // This is an initial guess at what needs to be fixed...more may be needed
34: if (attsImpl.getIndex("href") != -1) {
35: rewriteURL("a", "href", qName, atts, attsImpl);
36: rewriteURL("go", "href", qName, atts, attsImpl);
37: }
38:
39: super.startElement(uri, localName, qName, attsImpl);
40: }
41:
42: }
|