1 package org.apache.turbine.util;
2
3 /* ====================================================================
4 * The Apache Software License, Version 1.1
5 *
6 * Copyright (c) 2001 The Apache Software Foundation. All rights
7 * reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. The end-user documentation included with the redistribution,
22 * if any, must include the following acknowledgment:
23 * "This product includes software developed by the
24 * Apache Software Foundation (http://www.apache.org/)."
25 * Alternately, this acknowledgment may appear in the software itself,
26 * if and wherever such third-party acknowledgments normally appear.
27 *
28 * 4. The names "Apache" and "Apache Software Foundation" and
29 * "Apache Turbine" must not be used to endorse or promote products
30 * derived from this software without prior written permission. For
31 * written permission, please contact apache@apache.org.
32 *
33 * 5. Products derived from this software may not be called "Apache",
34 * "Apache Turbine", nor may "Apache" appear in their name, without
35 * prior written permission of the Apache Software Foundation.
36 *
37 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 * SUCH DAMAGE.
49 * ====================================================================
50 *
51 * This software consists of voluntary contributions made by many
52 * individuals on behalf of the Apache Software Foundation. For more
53 * information on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57 /***
58 * Holds basic server information under which Turbine is running.
59 * This class is accessable via the RunData object within the Turbine
60 * system. You can also use it as a placeholder for this information
61 * if you are only emulating a servlet system.
62 *
63 * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
64 * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
65 * @version $Id: ServerData.java,v 1.1.1.1 2001/08/16 05:09:41 jvanzyl Exp $
66 */
67 public class ServerData
68 {
69 /*** Cached serverName, */
70 private String serverName = null;
71
72 /*** Cached serverPort. */
73 private int serverPort = 80;
74
75 /*** Cached serverScheme. */
76 private String serverScheme = null;
77
78 /*** Cached script name. */
79 private String scriptName = null;
80
81 /*** Cached context path. */
82 private String contextPath = null;
83
84 /***
85 * Constructor.
86 *
87 * @param serverName The server name.
88 * @param serverPort The server port.
89 * @param serverScheme The server scheme.
90 * @param scriptName The script name.
91 */
92 public ServerData( String serverName,
93 int serverPort,
94 String serverScheme,
95 String scriptName,
96 String contextPath )
97 {
98 this.serverName = serverName;
99 this.serverPort = serverPort;
100 this.serverScheme = serverScheme;
101 this.scriptName = scriptName;
102 this.contextPath = contextPath;
103 }
104
105 /***
106 * Get the name of the server.
107 *
108 * @return A String.
109 */
110 public String getServerName()
111 {
112 if ( this.serverName == null )
113 return "";
114 return serverName;
115 }
116
117 /***
118 * Sets the cached serverName.
119 *
120 * @param sn A String.
121 */
122 public void setServerName(String sn)
123 {
124 this.serverName = sn;
125 }
126
127 /***
128 * Get the server port.
129 *
130 * @return An int.
131 */
132 public int getServerPort()
133 {
134 return this.serverPort;
135 }
136
137 /***
138 * Sets the cached serverPort.
139 *
140 * @param port An int.
141 */
142 public void setServerPort(int port)
143 {
144 this.serverPort = port;
145 }
146
147 /***
148 * Get the server scheme.
149 *
150 * @return A String.
151 */
152 public String getServerScheme()
153 {
154 if ( this.serverScheme == null )
155 return "";
156 return this.serverScheme;
157 }
158
159 /***
160 * Sets the cached serverScheme.
161 *
162 * @param ss A String.
163 */
164 public void setServerScheme(String ss)
165 {
166 this.serverScheme = ss;
167 }
168
169 /***
170 * Get the script name
171 *
172 * @return A String.
173 */
174 public String getScriptName()
175 {
176 if ( this.scriptName == null )
177 return "";
178 return this.scriptName;
179 }
180
181 /***
182 * Set the script name.
183 *
184 * @param sname A String.
185 */
186 public void setScriptName(String sname)
187 {
188 this.scriptName = sname;
189 }
190
191 /***
192 * Get the context path.
193 *
194 * @return A String.
195 */
196 public String getContextPath()
197 {
198 if ( this.contextPath == null )
199 return "";
200 return this.contextPath;
201 }
202
203 /***
204 * Set the context path.
205 *
206 * @param sname A String.
207 */
208 public void setContextPath(String cpath)
209 {
210 this.contextPath = cpath;
211 }
212 }
This page was automatically generated by Maven