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: */
18: package org.apache.lenya.cms.publication;
19:
20: /**
21: * <p>
22: * An object of this class represents a proxy configuration.
23: * </p>
24: * <p>
25: * Configuration example (<code>$PUB_HOME/config/publication.xml</code>):
26: * </p>
27: * <pre>
28: * <proxies>
29: * <proxy area="live" ssl="true" url="https://www.host.com/ssl/default"/>
30: * <proxy area="live" ssl="false" url="http://www.host.com/default"/>
31: * <proxy area="authoring" ssl="true" url="https://www.host.com/lenya/default/authoring"/>
32: * <proxy area="authoring" ssl="false" url="http://www.host.com/lenya/default/authoring"/>
33: * <proxies;>
34: * </pre>
35: *
36: * @version $Id: Proxy.java 535656 2007-05-06 21:08:27Z nettings $
37: */
38: public class Proxy {
39:
40: private String url;
41:
42: /**
43: * Returns the absolute URL of a particular document.
44: * @param document The document.
45: * @return A string.
46: */
47: public String getURL(Document document) {
48: return getUrl() + document.getCanonicalDocumentURL();
49: }
50:
51: /**
52: * Returns the proxy URL.
53: * @return A string.
54: */
55: public String getUrl() {
56: return this .url;
57: }
58:
59: /**
60: * Sets the proxy URL.
61: * @param _url The url to set.
62: */
63: public void setUrl(String _url) {
64: this .url = _url;
65: }
66:
67: /**
68: * @see java.lang.Object#toString()
69: */
70: public String toString() {
71: return "Proxy URL=[" + getUrl() + "]";
72: }
73: }
|