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;
06:
07: import com.sun.portal.rewriter.util.uri.DecoratedURI;
08: import com.sun.portal.rewriter.util.uri.PageSpec;
09:
10: /**
11: * Default translated provided as a part of core rewriter code, this rewrites
12: * all relative URL's to absolute URL's
13: *
14: * Users of the can customise the rewriter component by directly
15: * subclassing this class and overwriting hook4Translate() method other way is to
16: * implement the full Translator interface i.e translate() method
17: *
18: * @version 1.0 12/15/2001
19: * @author Raja Nagendra Kumar, Nagendra.Raja@sun.com
20: */
21: public class AbsoluteTranslator extends AbstractTranslator {
22: //Used in case of UBT
23: private String appendURL = null;
24:
25: public AbsoluteTranslator(final PageSpec aPageSpec) {
26: super (aPageSpec);
27: }//constructor
28:
29: //Use this constructor for UBT
30: public AbsoluteTranslator(final PageSpec aPageSpec,
31: final String appendURL) {
32: super (aPageSpec);
33: this .appendURL = appendURL;
34: }//constructor
35:
36: public AbsoluteTranslator(final PageSpec aPageSpec,
37: final AbsoluteJSFunctionSpec aJSFunctionSpec) {
38: super (aPageSpec, aJSFunctionSpec);
39: }//constructor
40:
41: public String hook4Translate(final DecoratedURI aAbsoluteURI,
42: final DecoratedURI aTranslatedURI) {
43: //UBT - start
44: if (appendURL != null)
45: aTranslatedURI.setAppendURL(appendURL);
46: //UBT - end
47: return aTranslatedURI.toExternalForm();
48: }//hook4Translate()
49:
50: }//class AbsoluteTranslator
|