You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/08/06 07:11:53 UTC
cvs commit: jakarta-turbine/src/java/org/apache/turbine/services/rundata DefaultTurbineRunData.java TurbineRunData.java TurbineRunDataService.java
jvanzyl 01/08/05 22:11:53
Modified: src/java/org/apache/turbine/services/rundata
DefaultTurbineRunData.java TurbineRunData.java
TurbineRunDataService.java
Log:
- getting rid of ServerData
Revision Changes Path
1.27 +40 -44 jakarta-turbine/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
Index: DefaultTurbineRunData.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- DefaultTurbineRunData.java 2001/08/06 03:00:30 1.26
+++ DefaultTurbineRunData.java 2001/08/06 05:11:52 1.27
@@ -68,7 +68,6 @@
import org.apache.turbine.util.parser.CookieParser;
import org.apache.turbine.Turbine;
import org.apache.turbine.ParameterParser;
-import org.apache.turbine.util.ServerData;
import org.apache.fulcrum.security.util.AccessControlList;
import org.apache.fulcrum.pool.Recyclable;
import org.apache.fulcrum.pool.RecyclableSupport;
@@ -96,7 +95,7 @@
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
* @author <a href="mailto:bhoeneis@ee.ethz.ch">Bernie Hoeneisen</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @version $Id: DefaultTurbineRunData.java,v 1.26 2001/08/06 03:00:30 dlr Exp $
+ * @version $Id: DefaultTurbineRunData.java,v 1.27 2001/08/06 05:11:52 jvanzyl Exp $
*/
public class DefaultTurbineRunData
extends RecyclableSupport
@@ -222,11 +221,6 @@
private Vector errors = new Vector();
/**
- * Holds ServerData (basic properties) about this RunData object.
- */
- private ServerData serverData;
-
- /**
* @see #getRemoteAddr()
*/
private String remoteAddr;
@@ -261,7 +255,24 @@
private String target;
private String message;
private FastHashMap temp;
+
+ // These were part of server data
+
+ /** Cached serverName, */
+ private String serverName = null;
+
+ /** Cached serverPort. */
+ private int serverPort = 80;
+ /** Cached serverScheme. */
+ private String serverScheme = null;
+
+ /** Cached script name. */
+ private String scriptName = null;
+
+ /** Cached context path. */
+ private String contextPath = null;
+
public void setTarget(String target)
{
this.target = target;
@@ -452,7 +463,6 @@
redirectURI = null;
statusCode = HttpServletResponse.SC_OK;
errors.clear();
- serverData = null;
remoteAddr = null;
remoteHost = null;
userAgent = null;
@@ -464,7 +474,13 @@
// Clear all the values from the temporary
// storage.
temp.clear();
-
+
+ //serverName = null;
+ //serverPort = 80;
+ //serverScheme = null;
+ //scriptName = null;
+ //contextPath = null;
+
super.dispose();
}
@@ -880,7 +896,7 @@
*/
public String getServerScheme()
{
- return getServerData().getServerScheme();
+ return serverScheme;
}
/**
@@ -890,7 +906,7 @@
*/
public String getServerName()
{
- return getServerData().getServerName();
+ return serverName;
}
/**
@@ -900,7 +916,7 @@
*/
public int getServerPort()
{
- return getServerData().getServerPort();
+ return serverPort;
}
/**
@@ -910,7 +926,7 @@
*/
public String getContextPath()
{
- return getServerData().getContextPath();
+ return contextPath;
}
/**
@@ -920,20 +936,10 @@
*/
public String getScriptName()
{
- return getServerData().getScriptName();
+ return scriptName;
}
/**
- * Gets the server data ofy the request.
- *
- * @return server data.
- */
- public ServerData getServerData()
- {
- return this.serverData;
- }
-
- /**
* Gets the IP address of the client that sent the request.
*
* @return a string.
@@ -1147,16 +1153,6 @@
}
}
- /**
- * Sets the server data of the request.
- *
- * @param serverData server data.
- */
- public void setServerData(ServerData serverData)
- {
- this.serverData = serverData;
- }
-
// ********************
// Miscellanous setters
// ********************
@@ -1176,9 +1172,9 @@
*
* @param ss a string.
*/
- protected void setServerScheme(String ss)
+ public void setServerScheme(String serverScheme)
{
- getServerData().setServerScheme(ss);
+ this.serverScheme = serverScheme;
}
/**
@@ -1186,9 +1182,9 @@
*
* @param sn a string.
*/
- protected void setServerName(String sn)
+ public void setServerName(String serverName)
{
- getServerData().setServerName(sn);
+ this.serverName = serverName;
}
/**
@@ -1196,9 +1192,9 @@
*
* @param port an int.
*/
- protected void setServerPort(int port)
+ public void setServerPort(int serverPort)
{
- getServerData().setServerPort(port);
+ this.serverPort = serverPort;
}
/**
@@ -1206,9 +1202,9 @@
*
* @param cp a string.
*/
- protected void setContextPath(String cp)
+ public void setContextPath(String contextPath)
{
- getServerData().setContextPath(cp);
+ this.contextPath = contextPath;
}
/**
@@ -1216,9 +1212,9 @@
*
* @param sn a string.
*/
- protected void setScriptName(String sn)
+ public void setScriptName(String scriptName)
{
- getServerData().setScriptName(sn);
+ this.scriptName = scriptName;
}
public void setMessage(String message)
1.6 +1 -9 jakarta-turbine/src/java/org/apache/turbine/services/rundata/TurbineRunData.java
Index: TurbineRunData.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/rundata/TurbineRunData.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TurbineRunData.java 2001/08/01 15:35:22 1.5
+++ TurbineRunData.java 2001/08/06 05:11:52 1.6
@@ -61,7 +61,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.turbine.util.parser.CookieParser;
-import org.apache.turbine.util.ServerData;
import org.apache.fulcrum.pool.Recyclable;
/**
@@ -78,7 +77,7 @@
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
* @author <a href="mailto:bhoeneis@ee.ethz.ch">Bernie Hoeneisen</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @version $Id: TurbineRunData.java,v 1.5 2001/08/01 15:35:22 jvanzyl Exp $
+ * @version $Id: TurbineRunData.java,v 1.6 2001/08/06 05:11:52 jvanzyl Exp $
*/
public interface TurbineRunData extends RunData,
Recyclable
@@ -138,11 +137,4 @@
* @param config a configuration.
*/
public void setServletConfig(ServletConfig config);
-
- /**
- * Sets the server data of the request.
- *
- * @param serverData server data.
- */
- public void setServerData(ServerData serverData);
}
1.10 +10 -9 jakarta-turbine/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java
Index: TurbineRunDataService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TurbineRunDataService.java 2001/08/01 15:35:22 1.9
+++ TurbineRunDataService.java 2001/08/06 05:11:52 1.10
@@ -65,7 +65,6 @@
import org.apache.turbine.RunData;
import org.apache.turbine.ParameterParser;
import org.apache.turbine.util.parser.CookieParser;
-import org.apache.turbine.util.ServerData;
import org.apache.fulcrum.ServiceException;
import org.apache.fulcrum.TurbineServices;
import org.apache.fulcrum.BaseService;
@@ -80,7 +79,7 @@
* the implementations should implement the Recyclable interface.
*
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
- * @version $Id: TurbineRunDataService.java,v 1.9 2001/08/01 15:35:22 jvanzyl Exp $
+ * @version $Id: TurbineRunDataService.java,v 1.10 2001/08/06 05:11:52 jvanzyl Exp $
*/
public class TurbineRunDataService
extends BaseService
@@ -274,8 +273,9 @@
// Set the servlet configuration.
data.setServletConfig(config);
- // Set the ServerData.
+ // Set server info
String contextPath;
+
try
{
contextPath = getContextPath != null ?
@@ -286,12 +286,13 @@
contextPath = "";
}
String scriptName = contextPath + req.getServletPath();
- data.setServerData(new ServerData(req.getServerName(),
- req.getServerPort(),
- req.getScheme(),
- scriptName,
- contextPath));
-
+
+ data.setServerName(req.getServerName());
+ data.setServerPort(req.getServerPort());
+ data.setServerScheme(req.getScheme());
+ data.setScriptName(scriptName);
+ data.setContextPath(contextPath);
+
return (RunData) data;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org