You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2003/05/07 18:02:03 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/util/uri URI.java BaseURI.java
henning 2003/05/07 09:02:03
Modified: src/java/org/apache/turbine/util DynamicURI.java
src/java/org/apache/turbine/util/parser CookieParser.java
DefaultCookieParser.java
src/java/org/apache/turbine/util/uri BaseURI.java
Added: src/java/org/apache/turbine/util/uri URI.java
Log:
CookieParser is unfortunately exposing DynamicURI to the rest of the
world. This isn't simply changeable because it would break existing,
working code if setCookiePath() / getCookiePath() doesn't accept
DynamicURI objects any longer.
Adding an Interface which is implemented by both DynamicURI and
BaseURI and changing the parameter and return type to use this should
solve this problem.
Revision Changes Path
1.21 +3 -1 jakarta-turbine-2/src/java/org/apache/turbine/util/DynamicURI.java
Index: DynamicURI.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/DynamicURI.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- DynamicURI.java 7 May 2003 14:34:37 -0000 1.20
+++ DynamicURI.java 7 May 2003 16:02:00 -0000 1.21
@@ -74,6 +74,7 @@
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.util.parser.ParameterParser;
import org.apache.turbine.util.parser.ParserUtils;
+import org.apache.turbine.util.uri.URI;
import org.apache.turbine.util.uri.URIConstants;
/**
@@ -104,6 +105,7 @@
* @deprecated Use {@link org.apache.turbine.util.uri.TurbineURI} instead.
*/
public class DynamicURI
+ implements URI
{
/** @deprecated Use URIConstants.HTTP */
public static final String HTTP = URIConstants.HTTP;
1.2 +6 -4 jakarta-turbine-2/src/java/org/apache/turbine/util/parser/CookieParser.java
Index: CookieParser.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/parser/CookieParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CookieParser.java 11 Apr 2003 13:15:11 -0000 1.1
+++ CookieParser.java 7 May 2003 16:02:01 -0000 1.2
@@ -57,8 +57,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.turbine.util.DynamicURI;
import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.uri.URI;
/**
* CookieParser is an interface to a utility to to get and set values
@@ -130,13 +130,15 @@
/**
* Get the Path where cookies will be stored
+ * @deprecated Will be replaced by {@link org.apache.turbine.util.uri.TurbineURI} getCookiePath()
*/
- DynamicURI getCookiePath();
+ URI getCookiePath();
/**
* Set the path for cookie storage
+ * @deprecated Will be replaced by setCookiePath({@link org.apache.turbine.util.uri.TurbineURI})
*/
- void setCookiePath(DynamicURI path);
+ void setCookiePath(URI path);
/**
* Set a cookie that will be stored on the client for
1.14 +10 -7 jakarta-turbine-2/src/java/org/apache/turbine/util/parser/DefaultCookieParser.java
Index: DefaultCookieParser.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/parser/DefaultCookieParser.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefaultCookieParser.java 11 Apr 2003 13:15:11 -0000 1.13
+++ DefaultCookieParser.java 7 May 2003 16:02:01 -0000 1.14
@@ -61,9 +61,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.turbine.util.DynamicURI;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.pool.Recyclable;
+import org.apache.turbine.util.uri.URI;
+import org.apache.turbine.util.uri.TurbineURI;
/**
* CookieParser is used to get and set values of Cookies on the Client
@@ -110,7 +111,7 @@
private HttpServletResponse response;
/** The cookie path. */
- private DynamicURI cookiePath = null;
+ private URI cookiePath = null;
/**
* Constructs a new CookieParser.
@@ -188,7 +189,7 @@
String enc = request.getCharacterEncoding();
setCharacterEncoding(enc != null ? enc : "US-ASCII");
- cookiePath = new DynamicURI(data);
+ cookiePath = new TurbineURI(data);
Cookie[] cookies = request.getCookies();
@@ -212,8 +213,9 @@
* Get the Path where cookies will be stored
*
* @return path for cookie storage
+ * @deprecated Will be replaced by {@link org.apache.turbine.util.uri.TurbineURI} getCookiePath()
*/
- public DynamicURI getCookiePath()
+ public URI getCookiePath()
{
return cookiePath;
}
@@ -222,10 +224,11 @@
* Set the path for cookie storage
*
* @param path path for cookie storage
+ * @deprecated Will be replaced by setCookiePath({@link org.apache.turbine.util.uri.TurbineURI})
*/
- public void setCookiePath(DynamicURI path)
+ public void setCookiePath(URI cookiePath)
{
- cookiePath = path;
+ this.cookiePath = cookiePath;
}
/**
1.2 +3 -2 jakarta-turbine-2/src/java/org/apache/turbine/util/uri/BaseURI.java
Index: BaseURI.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/uri/BaseURI.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseURI.java 7 May 2003 13:58:20 -0000 1.1
+++ BaseURI.java 7 May 2003 16:02:02 -0000 1.2
@@ -79,7 +79,8 @@
*/
public abstract class BaseURI
- implements URIConstants
+ implements URI,
+ URIConstants
{
/** Logging */
private static Log log = LogFactory.getLog(BaseURI.class);
1.1 jakarta-turbine-2/src/java/org/apache/turbine/util/uri/URI.java
Index: URI.java
===================================================================
package org.apache.turbine.util.uri;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.ServerData;
/**
* An interface class which describes the absolute minimum of methods that
* a Turbine URI class must implement.
*
* @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
* @version $Id: URI.java,v 1.1 2003/05/07 16:02:02 henning Exp $
*/
public interface URI
{
/**
* Gets the script name (/servlets/Turbine).
*
* @return A String with the script name.
*/
String getScriptName();
/**
* Gets the context path.
*
* @return A String with the context path.
*/
String getContextPath();
/**
* Gets the server name.
*
* @return A String with the server name.
*/
String getServerName();
/**
* Gets the server port.
*
* @return A String with the server port.
*/
int getServerPort();
/**
* Returns the current Server Scheme
*
* @return The current Server scheme
*
*/
String getServerScheme();
/**
* Returns the current reference anchor.
*
* @return A String containing the reference.
*/
String getReference();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org