01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter.engines.html;
06:
07: import com.sun.portal.rewriter.Translator;
08: import com.sun.portal.rewriter.engines.AbstractRewriter;
09: import com.sun.portal.rewriter.engines.PageContent;
10: import com.sun.portal.rewriter.engines.RewriterBroker;
11:
12: /**
13: * Rewriter to translate HTML Content. Due to performance issues, internally
14: * this uses MarkupRewriter to do the translation JOB.
15: *
16: * @version 1.0 12/15/2001
17: * @author Raja Nagendra Kumar, Nagendra.Raja@sun.com
18: */
19: public final class HTMLRewriter extends AbstractRewriter {
20: public HTMLRewriter(final RewriterBroker aRewriterBroker) {
21: super (aRewriterBroker, HTML_MIME);
22: }//constructor
23:
24: public final void plugableRewriter(final PageContent aPageContent,
25: final Translator aTranslator) {
26: getRewriterBroker().getMarkupRewriter().plugableRewriter(
27: aPageContent, aTranslator);
28: }//plugableRewriter()
29:
30: public static String parseSPAN(final String aURI,
31: final Translator aTranslator) {
32: final String lContent = aURI.trim();
33: if (lContent.startsWith("http://")
34: || lContent.startsWith("https://")) {
35: return aTranslator.translate(aURI);
36: } else {
37: return aURI;
38: }
39: }//parseSPAN()
40:
41: public final void endRewriting(final PageContent aPageContent,
42: final Translator aTranslator) {
43: getRewriterBroker().getMarkupRewriter().endRewriting(
44: aPageContent, aTranslator);
45: }//endRewriting()
46:
47: }//class HTMLRewriter
|