jfarcand 2002/12/03 08:04:02
Modified: coyote/src/java/org/apache/coyote Response.java
coyote/src/java/org/apache/coyote/tomcat5
CoyoteResponse.java
Log:
As Bill's recommends, do not set a default locale in Response directly.
Revision Changes Path
1.18 +4 -10
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java
Index: Response.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Response.java 3 Dec 2002 02:29:14 -0000 1.17
+++ Response.java 3 Dec 2002 16:04:02 -0000 1.18
@@ -92,13 +92,7 @@
// ----------------------------------------------------- Instance Variables
-
- /**
- * Default locale
- */
- private static Locale DEFAULT_LOCALE = new Locale("en", "US");
-
-
+
/**
* Status code.
*/
@@ -148,7 +142,7 @@
protected String contentLanguage = null;
protected String characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
protected int contentLength = -1;
- private Locale locale = DEFAULT_LOCALE;
+ private Locale locale = null;
/**
* Holds request error exception.
@@ -317,7 +311,7 @@
// Reset the headers only if this is the main request,
// not for included
contentType = Constants.DEFAULT_CONTENT_TYPE;
- locale = DEFAULT_LOCALE;
+ locale = null;
contentLanguage = null;
characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
contentLength = -1;
@@ -531,7 +525,7 @@
contentType = Constants.DEFAULT_CONTENT_TYPE;
contentLanguage = null;
- locale = DEFAULT_LOCALE;
+ locale = null;
characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
contentLength = -1;
status = 200;
1.13 +14 -6
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java
Index: CoyoteResponse.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- CoyoteResponse.java 3 Dec 2002 02:29:14 -0000 1.12
+++ CoyoteResponse.java 3 Dec 2002 16:04:02 -0000 1.13
@@ -136,7 +136,12 @@
// ----------------------------------------------------- Instance Variables
+ /**
+ * Default locale as mandated by the spec.
+ */
+ private static Locale DEFAULT_LOCALE = new Locale("en", "US");
+
/**
* The date format we will use for creating date headers.
*/
@@ -326,13 +331,13 @@
error = false;
isContentTypeSet = false;
isCharacterEncodingSet = false;
+
cookies.clear();
if ((Constants.SECURITY) && (facade != null)) {
facade.clear();
facade = null;
}
-
}
@@ -607,6 +612,10 @@
* Return the Locale assigned to this response.
*/
public Locale getLocale() {
+ // Lazy setting. If the local is null, then return the default one.
+ if ( coyoteResponse.getLocale() == null){
+ coyoteResponse.setLocale(DEFAULT_LOCALE);
+ }
return (coyoteResponse.getLocale());
}
@@ -652,7 +661,6 @@
coyoteResponse.reset();
outputBuffer.reset();
-
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>