01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.rewriter;
18:
19: import org.apache.commons.logging.Log;
20: import org.apache.commons.logging.LogFactory;
21:
22: /**
23: * BasicRewriter
24: *
25: * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
26: * @version $Id: BasicRewriter.java 516448 2007-03-09 16:25:47Z ate $
27: */
28: public class BasicRewriter extends AbstractRewriter implements Rewriter {
29: protected final static Log log = LogFactory
30: .getLog(BasicRewriter.class);
31:
32: /*
33: * This callback is called by the ParserAdaptor implementation to write
34: * back all rewritten URLs to point to the proxy server.
35: * Given the targetURL, rewrites the link as a link back to the proxy server.
36: *
37: * @return the rewritten URL to the proxy server.
38: *
39: */
40: public String rewriteUrl(String url, String tag, String attribute) {
41: return getBaseRelativeUrl(url);
42: }
43:
44: /* (non-Javadoc)
45: * @see org.apache.jetspeed.cps.rewriter.Rewriter#shouldRemoveTag(java.lang.String)
46: */
47: public boolean shouldRemoveTag(String tag) {
48: if (tag.equalsIgnoreCase("html")) {
49: return true;
50: }
51: return false;
52: }
53:
54: /* (non-Javadoc)
55: * @see org.apache.jetspeed.cps.rewriter.Rewriter#shouldStripTag(java.lang.String)
56: */
57: public boolean shouldStripTag(String tag) {
58: if (tag.equalsIgnoreCase("head")) {
59: return true;
60: }
61: return false;
62: }
63:
64: /* (non-Javadoc)
65: * @see org.apache.jetspeed.cps.rewriter.Rewriter#shouldRemoveComments()
66: */
67: public boolean shouldRemoveComments() {
68: return true;
69: }
70:
71: }
|