JBossWeb SVN: r1478 - in trunk/java/org/apache: catalina/deploy and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-31 08:08:39 -0400 (Mon, 31 May 2010)
New Revision: 1478
Modified:
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/apache/catalina/deploy/SessionCookie.java
trunk/java/org/apache/catalina/realm/RealmBase.java
trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
Log:
- Add session path parameter configuration.
- Done by delaying parsing until after mapping, without any performance impact.
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2010-05-21 15:11:17 UTC (rev 1477)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2010-05-31 12:08:39 UTC (rev 1478)
@@ -128,13 +128,6 @@
/**
- * The match string for identifying a session ID parameter.
- */
- private static final String match =
- ";" + Globals.SESSION_PARAMETER_NAME + "=";
-
-
- /**
* The string manager for this package.
*/
protected StringManager sm =
@@ -457,9 +450,6 @@
req.serverName().setString(proxyName);
}
- // Parse session Id
- parseSessionId(req, request);
-
// URI decoding
MessageBytes decodedURI = req.decodedURI();
decodedURI.duplicate(req.requestURI());
@@ -574,7 +564,10 @@
}
// Discard session id if SessionTrackingMode.URL is disabled
- if (!request.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL)) {
+ if (request.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL)) {
+ // Parse session Id
+ parseSessionId(req, request);
+ } else {
request.setRequestedSessionId(null);
request.setRequestedSessionURL(false);
}
@@ -587,7 +580,7 @@
if (request.isRequestedSessionIdFromURL()) {
// This is not optimal, but as this is not very common, it
// shouldn't matter
- redirectPath = redirectPath + ";" + Globals.SESSION_PARAMETER_NAME + "="
+ redirectPath = redirectPath + request.getContext().getSessionCookie().getPathParameterName()
+ request.getRequestedSessionId();
}
if (query != null) {
@@ -614,7 +607,8 @@
protected void parseSessionId(org.apache.coyote.Request req, Request request) {
ByteChunk uriBC = req.requestURI().getByteChunk();
- int semicolon = uriBC.indexOf(match, 0, match.length(), 0);
+ String pathParameterName = request.getContext().getSessionCookie().getPathParameterName();
+ int semicolon = uriBC.indexOf(pathParameterName, 0, pathParameterName.length(), 0);
if (semicolon > 0) {
@@ -622,7 +616,7 @@
int start = uriBC.getStart();
int end = uriBC.getEnd();
- int sessionIdStart = semicolon + match.length();
+ int sessionIdStart = semicolon + pathParameterName.length();
int semicolon2 = uriBC.indexOf(';', sessionIdStart);
if (semicolon2 >= 0) {
request.setRequestedSessionId
@@ -663,9 +657,6 @@
return;
String cookieName = request.getContext().getSessionCookie().getName();
- if (cookieName == null) {
- cookieName = Globals.SESSION_COOKIE_NAME;
- }
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
if (scookie.getName().equals(cookieName)) {
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2010-05-21 15:11:17 UTC (rev 1477)
+++ trunk/java/org/apache/catalina/connector/Request.java 2010-05-31 12:08:39 UTC (rev 1478)
@@ -1752,11 +1752,7 @@
return;
if (response != null) {
- String cookieName = context.getSessionCookie().getName();
- if (cookieName == null) {
- cookieName = Globals.SESSION_COOKIE_NAME;
- }
- Cookie cookie = new Cookie(cookieName, newSessionId);
+ Cookie cookie = new Cookie(context.getSessionCookie().getName(), newSessionId);
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
}
@@ -2594,11 +2590,7 @@
// If there was no cookie with the current session id, add a cookie to the response
if ( (session != null) && context.getCookies()
&& !(isRequestedSessionIdFromCookie() && (session.getIdInternal().equals(getRequestedSessionId()))) ) {
- String cookieName = context.getSessionCookie().getName();
- if (cookieName == null) {
- cookieName = Globals.SESSION_COOKIE_NAME;
- }
- Cookie cookie = new Cookie(cookieName, session.getIdInternal());
+ Cookie cookie = new Cookie(context.getSessionCookie().getName(), session.getIdInternal());
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
}
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2010-05-21 15:11:17 UTC (rev 1477)
+++ trunk/java/org/apache/catalina/connector/Response.java 2010-05-31 12:08:39 UTC (rev 1478)
@@ -1513,7 +1513,7 @@
String file = url.getFile();
if ((file == null) || !file.startsWith(contextPath))
return (false);
- String tok = ";" + Globals.SESSION_PARAMETER_NAME + "=" + session.getIdInternal();
+ String tok = request.getContext().getSessionCookie().getPathParameterName() + session.getIdInternal();
if (file.indexOf(tok, contextPath.length()) >= 0)
return (false);
}
@@ -1649,9 +1649,7 @@
}
StringBuilder sb = new StringBuilder(path);
if( sb.length() > 0 ) { // jsessionid can't be first.
- sb.append(";");
- sb.append(Globals.SESSION_PARAMETER_NAME);
- sb.append("=");
+ sb.append(request.getContext().getSessionCookie().getPathParameterName());
sb.append(sessionId);
}
sb.append(anchor);
Modified: trunk/java/org/apache/catalina/deploy/SessionCookie.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/SessionCookie.java 2010-05-21 15:11:17 UTC (rev 1477)
+++ trunk/java/org/apache/catalina/deploy/SessionCookie.java 2010-05-31 12:08:39 UTC (rev 1478)
@@ -21,6 +21,8 @@
import javax.servlet.SessionCookieConfig;
+import org.apache.catalina.Globals;
+
public class SessionCookie implements SessionCookieConfig, Serializable {
protected String domain = null;
@@ -29,7 +31,8 @@
protected boolean httpOnly = false;
protected boolean secure = false;
protected int maxAge = -1;
- protected String name = null;
+ protected String name = Globals.SESSION_COOKIE_NAME;
+ protected String pathParameterName = ";" + Globals.SESSION_PARAMETER_NAME + "=";
public SessionCookie() {
}
@@ -87,7 +90,14 @@
}
public void setName(String name) {
- this.name = name;
+ if (name != null) {
+ this.name = name;
+ pathParameterName = ";" + name + "=";
+ }
}
+ public String getPathParameterName() {
+ return pathParameterName;
+ }
+
}
Modified: trunk/java/org/apache/catalina/realm/RealmBase.java
===================================================================
--- trunk/java/org/apache/catalina/realm/RealmBase.java 2010-05-21 15:11:17 UTC (rev 1477)
+++ trunk/java/org/apache/catalina/realm/RealmBase.java 2010-05-31 12:08:39 UTC (rev 1478)
@@ -960,9 +960,7 @@
String requestedSessionId = request.getRequestedSessionId();
if ((requestedSessionId != null) &&
request.isRequestedSessionIdFromURL()) {
- file.append(";");
- file.append(Globals.SESSION_PARAMETER_NAME);
- file.append("=");
+ file.append(request.getContext().getSessionCookie().getPathParameterName());
file.append(requestedSessionId);
}
String queryString = request.getQueryString();
Modified: trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
===================================================================
--- trunk/java/org/apache/tomcat/util/buf/ByteChunk.java 2010-05-21 15:11:17 UTC (rev 1477)
+++ trunk/java/org/apache/tomcat/util/buf/ByteChunk.java 2010-05-31 12:08:39 UTC (rev 1478)
@@ -824,6 +824,86 @@
/**
+ * Returns the first instance of the given byte in the byte array between
+ * the specified start and end.
+ *
+ * @param bytes The byte array to search
+ * @param start The point to start searching from in the byte array
+ * @param end The point to stop searching in the byte array
+ * @param b The byte to search for
+ * @return The position of the first instance of the byte or -1 if the
+ * byte is not found.
+ */
+ public static int findByte(byte bytes[], int start, int end, byte b) {
+ int offset = start;
+ while (offset < end) {
+ if (bytes[offset] == b) {
+ return offset;
+ }
+ offset++;
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the first instance of any of the given bytes in the byte array
+ * between the specified start and end.
+ *
+ * @param bytes The byte array to search
+ * @param start The point to start searching from in the byte array
+ * @param end The point to stop searching in the byte array
+ * @param b The array of bytes to search for
+ * @return The position of the first instance of the byte or -1 if the
+ * byte is not found.
+ */
+ public static int findBytes(byte bytes[], int start, int end, byte b[]) {
+ int blen = b.length;
+ int offset = start;
+ while (offset < end) {
+ for (int i = 0; i < blen; i++)
+ if (bytes[offset] == b[i]) {
+ return offset;
+ }
+ offset++;
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the first instance of any byte that is not one of the given bytes
+ * in the byte array between the specified start and end.
+ *
+ * @param bytes The byte array to search
+ * @param start The point to start searching from in the byte array
+ * @param end The point to stop searching in the byte array
+ * @param c The list of bytes to search for
+ * @return The position of the first instance a byte that is not
+ * in the list of bytes to search for or -1 if no such byte
+ * is found.
+ */
+ public static int findNotBytes(byte bytes[], int start, int end, byte b[]) {
+ int blen = b.length;
+ int offset = start;
+ boolean found;
+
+ while (offset < end) {
+ found = true;
+ for (int i = 0; i < blen; i++) {
+ if (bytes[offset] == b[i]) {
+ found=false;
+ break;
+ }
+ }
+ if (found) {
+ return offset;
+ }
+ offset++;
+ }
+ return -1;
+ }
+
+
+ /**
* Convert specified String to a byte array. This ONLY WORKS for ascii, UTF chars will be truncated.
*
* @param value to convert to byte array
14 years, 7 months
JBossWeb SVN: r1477 - tags.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2010-05-21 11:11:17 -0400 (Fri, 21 May 2010)
New Revision: 1477
Added:
tags/JBOSSWEB_2_1_8_GA/
Log:
2.1.8 tag.2.1.8 tag.
Copied: tags/JBOSSWEB_2_1_8_GA (from rev 1476, branches/2.1.x)
14 years, 7 months
JBossWeb SVN: r1476 - trunk/java/org/apache/catalina/connector.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-20 18:56:58 -0400 (Thu, 20 May 2010)
New Revision: 1476
Modified:
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
Log:
- Use the specified cookie name for the session cookie.
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2010-05-18 22:06:20 UTC (rev 1475)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2010-05-20 22:56:58 UTC (rev 1476)
@@ -662,9 +662,13 @@
if (count <= 0)
return;
+ String cookieName = request.getContext().getSessionCookie().getName();
+ if (cookieName == null) {
+ cookieName = Globals.SESSION_COOKIE_NAME;
+ }
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
- if (scookie.getName().equals(Globals.SESSION_COOKIE_NAME)) {
+ if (scookie.getName().equals(cookieName)) {
// Override anything requested in the URL
if (!request.isRequestedSessionIdFromCookie()) {
// Accept only the first session id cookie
14 years, 7 months
JBossWeb SVN: r1475 - trunk/java/org/apache/jasper/compiler.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-18 18:06:20 -0400 (Tue, 18 May 2010)
New Revision: 1475
Modified:
trunk/java/org/apache/jasper/compiler/JspUtil.java
Log:
- Port patch: add missing identifier.
Modified: trunk/java/org/apache/jasper/compiler/JspUtil.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JspUtil.java 2010-05-18 13:14:35 UTC (rev 1474)
+++ trunk/java/org/apache/jasper/compiler/JspUtil.java 2010-05-18 22:06:20 UTC (rev 1475)
@@ -70,7 +70,7 @@
"interface", "long", "native", "new", "package",
"private", "protected", "public", "return", "short",
"static", "strictfp", "super", "switch", "synchronized",
- "this", "throws", "transient", "try", "void",
+ "this", "throw", "throws", "transient", "try", "void",
"volatile", "while" };
public static final int CHUNKSIZE = 1024;
14 years, 7 months
JBossWeb SVN: r1474 - trunk/java/org/apache/tomcat/util/buf.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-18 09:14:35 -0400 (Tue, 18 May 2010)
New Revision: 1474
Modified:
trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
Log:
- Port minor indexOf fix.
Modified: trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
===================================================================
--- trunk/java/org/apache/tomcat/util/buf/ByteChunk.java 2010-05-17 17:46:58 UTC (rev 1473)
+++ trunk/java/org/apache/tomcat/util/buf/ByteChunk.java 2010-05-18 13:14:35 UTC (rev 1474)
@@ -691,22 +691,23 @@
}
public int indexOf( String src, int srcOff, int srcLen, int myOff ) {
- char first=src.charAt( srcOff );
+ char first=src.charAt( srcOff );
- // Look for first char
- int srcEnd = srcOff + srcLen;
+ // Look for first char
+ int srcEnd = srcOff + srcLen;
- for( int i=myOff+start; i <= (end - srcLen); i++ ) {
- if( buff[i] != first ) continue;
- // found first char, now look for a match
+ mainLoop:
+ for( int i=myOff+start; i <= (end - srcLen); i++ ) {
+ if( buff[i] != first ) continue;
+ // found first char, now look for a match
int myPos=i+1;
- for( int srcPos=srcOff + 1; srcPos< srcEnd; ) {
+ for( int srcPos=srcOff + 1; srcPos< srcEnd; ) {
if( buff[myPos++] != src.charAt( srcPos++ ))
- break;
- if( srcPos==srcEnd ) return i-start; // found it
- }
- }
- return -1;
+ continue mainLoop;
+ }
+ return i-start; // found it
+ }
+ return -1;
}
// -------------------- Hash code --------------------
14 years, 7 months
JBossWeb SVN: r1473 - in trunk/java/org: apache/catalina/deploy and 14 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-17 13:46:58 -0400 (Mon, 17 May 2010)
New Revision: 1473
Modified:
trunk/java/org/apache/catalina/core/StandardEngine.java
trunk/java/org/apache/catalina/core/StandardHost.java
trunk/java/org/apache/catalina/deploy/FilterMap.java
trunk/java/org/apache/catalina/servlets/CGIServlet.java
trunk/java/org/apache/catalina/servlets/WebdavServlet.java
trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java
trunk/java/org/apache/catalina/ssi/SSIMediator.java
trunk/java/org/apache/catalina/ssi/SSIProcessor.java
trunk/java/org/apache/catalina/ssi/SSIServlet.java
trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
trunk/java/org/apache/catalina/util/ExtensionValidator.java
trunk/java/org/apache/catalina/util/MIME2Java.java
trunk/java/org/apache/catalina/util/URL.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/Http11Processor.java
trunk/java/org/apache/jasper/compiler/Validator.java
trunk/java/org/apache/jasper/tagplugins/jstl/Util.java
trunk/java/org/apache/tomcat/util/buf/MessageBytes.java
trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java
trunk/java/org/apache/tomcat/util/http/MimeMap.java
trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersImpl.java
trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
trunk/java/org/apache/tomcat/util/http/fileupload/ServletFileUpload.java
trunk/java/org/apache/tomcat/util/modeler/OperationInfo.java
trunk/java/org/apache/tomcat/util/net/URL.java
trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
trunk/java/org/jboss/web/php/ScriptEnvironment.java
trunk/java/org/jboss/web/rewrite/RewriteCond.java
Log:
- Specify locale rather than use the default.
Modified: trunk/java/org/apache/catalina/core/StandardEngine.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardEngine.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/core/StandardEngine.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -21,6 +21,7 @@
import java.io.File;
import java.util.List;
+import java.util.Locale;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
@@ -144,7 +145,7 @@
if (host == null) {
this.defaultHost = null;
} else {
- this.defaultHost = host.toLowerCase();
+ this.defaultHost = host.toLowerCase(Locale.ENGLISH);
}
support.firePropertyChange("defaultHost", oldDefaultHost,
this.defaultHost);
Modified: trunk/java/org/apache/catalina/core/StandardHost.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardHost.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/core/StandardHost.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -19,6 +19,8 @@
package org.apache.catalina.core;
+import java.util.Locale;
+
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -259,7 +261,7 @@
throw new IllegalArgumentException
(sm.getString("standardHost.nullName"));
- name = name.toLowerCase(); // Internally all names are lower case
+ name = name.toLowerCase(Locale.ENGLISH); // Internally all names are lower case
String oldName = this.name;
this.name = name;
@@ -296,7 +298,7 @@
*/
public void addAlias(String alias) {
- alias = alias.toLowerCase();
+ alias = alias.toLowerCase(Locale.ENGLISH);
// Skip duplicate aliases
for (int i = 0; i < aliases.length; i++) {
@@ -364,7 +366,7 @@
*/
public void removeAlias(String alias) {
- alias = alias.toLowerCase();
+ alias = alias.toLowerCase(Locale.ENGLISH);
// Make sure this alias is currently present
int n = -1;
Modified: trunk/java/org/apache/catalina/deploy/FilterMap.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/FilterMap.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/deploy/FilterMap.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -20,6 +20,7 @@
import java.io.Serializable;
+import java.util.Locale;
import javax.servlet.DispatcherType;
@@ -136,7 +137,7 @@
* representing the state of when filters should be applied.
*/
public void setDispatcher(String dispatcherString) {
- String dispatcher = dispatcherString.toUpperCase();
+ String dispatcher = dispatcherString.toUpperCase(Locale.ENGLISH);
if (dispatcher.equals(DispatcherType.FORWARD.name())) {
// apply FORWARD to the global dispatcherMapping.
Modified: trunk/java/org/apache/catalina/servlets/CGIServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/CGIServlet.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/servlets/CGIServlet.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -1063,7 +1063,7 @@
String header = null;
while (headers.hasMoreElements()) {
header = null;
- header = headers.nextElement().toUpperCase();
+ header = headers.nextElement().toUpperCase(Locale.ENGLISH);
//REMIND: rewrite multiple headers as if received as single
//REMIND: change character set
//REMIND: I forgot what the previous REMIND means
Modified: trunk/java/org/apache/catalina/servlets/WebdavServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -30,6 +30,7 @@
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Locale;
import java.util.Stack;
import java.util.TimeZone;
import java.util.Vector;
@@ -435,8 +436,8 @@
if (path.endsWith("/"))
path = path.substring(0, path.length() - 1);
- if ((path.toUpperCase().startsWith("/WEB-INF")) ||
- (path.toUpperCase().startsWith("/META-INF"))) {
+ if ((path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF")) ||
+ (path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))) {
resp.sendError(WebdavStatus.SC_FORBIDDEN);
return;
}
@@ -711,8 +712,8 @@
String path = getRelativePath(req);
- if ((path.toUpperCase().startsWith("/WEB-INF")) ||
- (path.toUpperCase().startsWith("/META-INF"))) {
+ if ((path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF")) ||
+ (path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))) {
resp.sendError(WebdavStatus.SC_FORBIDDEN);
return;
}
@@ -1595,16 +1596,16 @@
if (debug > 0)
log("Dest path :" + destinationPath);
- if ((destinationPath.toUpperCase().startsWith("/WEB-INF")) ||
- (destinationPath.toUpperCase().startsWith("/META-INF"))) {
+ if ((destinationPath.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF")) ||
+ (destinationPath.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))) {
resp.sendError(WebdavStatus.SC_FORBIDDEN);
return false;
}
String path = getRelativePath(req);
- if ((path.toUpperCase().startsWith("/WEB-INF")) ||
- (path.toUpperCase().startsWith("/META-INF"))) {
+ if ((path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF")) ||
+ (path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))) {
resp.sendError(WebdavStatus.SC_FORBIDDEN);
return false;
}
@@ -1798,8 +1799,8 @@
HttpServletResponse resp, boolean setStatus)
throws ServletException, IOException {
- if ((path.toUpperCase().startsWith("/WEB-INF")) ||
- (path.toUpperCase().startsWith("/META-INF"))) {
+ if ((path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF")) ||
+ (path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))) {
resp.sendError(WebdavStatus.SC_FORBIDDEN);
return false;
}
@@ -1883,8 +1884,8 @@
if (debug > 1)
log("Delete:" + path);
- if ((path.toUpperCase().startsWith("/WEB-INF")) ||
- (path.toUpperCase().startsWith("/META-INF"))) {
+ if ((path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF")) ||
+ (path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))) {
errorList.put(path, new Integer(WebdavStatus.SC_FORBIDDEN));
return;
}
@@ -2023,8 +2024,8 @@
// Exclude any resource in the /WEB-INF and /META-INF subdirectories
// (the "toUpperCase()" avoids problems on Windows systems)
- if (path.toUpperCase().startsWith("/WEB-INF") ||
- path.toUpperCase().startsWith("/META-INF"))
+ if (path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF") ||
+ path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))
return;
CacheEntry cacheEntry = resources.lookupCache(path);
@@ -2316,8 +2317,8 @@
// Exclude any resource in the /WEB-INF and /META-INF subdirectories
// (the "toUpperCase()" avoids problems on Windows systems)
- if (path.toUpperCase().startsWith("/WEB-INF") ||
- path.toUpperCase().startsWith("/META-INF"))
+ if (path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF") ||
+ path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF"))
return;
// Retrieving the lock associated with the lock-null resource
Modified: trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -207,7 +207,7 @@
public void addDateHeader(String name, long value) {
super.addDateHeader(name, value);
- String lname = name.toLowerCase();
+ String lname = name.toLowerCase(Locale.ENGLISH);
if (lname.equals(LAST_MODIFIED)) {
lastModified = value;
}
@@ -215,7 +215,7 @@
public void addHeader(String name, String value) {
super.addHeader(name, value);
- String lname = name.toLowerCase();
+ String lname = name.toLowerCase(Locale.ENGLISH);
if (lname.equals(LAST_MODIFIED)) {
try {
synchronized(RFC1123_FORMAT) {
@@ -229,7 +229,7 @@
public void setDateHeader(String name, long value) {
super.setDateHeader(name, value);
- String lname = name.toLowerCase();
+ String lname = name.toLowerCase(Locale.ENGLISH);
if (lname.equals(LAST_MODIFIED)) {
lastModified = value;
}
@@ -237,7 +237,7 @@
public void setHeader(String name, String value) {
super.setHeader(name, value);
- String lname = name.toLowerCase();
+ String lname = name.toLowerCase(Locale.ENGLISH);
if (lname.equals(LAST_MODIFIED)) {
try {
synchronized(RFC1123_FORMAT) {
Modified: trunk/java/org/apache/catalina/ssi/SSIMediator.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIMediator.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/ssi/SSIMediator.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -22,6 +22,7 @@
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Set;
import java.util.TimeZone;
import org.apache.catalina.util.DateTool;
@@ -181,7 +182,7 @@
public String getVariableValue(String variableName, String encoding) {
- String lowerCaseVariableName = variableName.toLowerCase();
+ String lowerCaseVariableName = variableName.toLowerCase(Locale.ENGLISH);
String variableValue = null;
if (!isNameReserved(lowerCaseVariableName)) {
//Try getting it externally first, if it fails, try getting the
@@ -189,7 +190,7 @@
// value
variableValue = ssiExternalResolver.getVariableValue(variableName);
if (variableValue == null) {
- variableName = variableName.toUpperCase();
+ variableName = variableName.toUpperCase(Locale.ENGLISH);
variableValue = (String)ssiExternalResolver
.getVariableValue(className + "." + variableName);
}
Modified: trunk/java/org/apache/catalina/ssi/SSIProcessor.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIProcessor.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/ssi/SSIProcessor.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -22,6 +22,7 @@
import java.io.Reader;
import java.io.StringWriter;
import java.util.HashMap;
+import java.util.Locale;
import java.util.StringTokenizer;
import org.apache.catalina.util.IOTools;
/**
@@ -133,7 +134,7 @@
// during the loop
String configErrMsg = ssiMediator.getConfigErrMsg();
SSICommand ssiCommand = (SSICommand)commands
- .get(strCmd.toLowerCase());
+ .get(strCmd.toLowerCase(Locale.ENGLISH));
String errorMessage = null;
if (ssiCommand == null) {
errorMessage = "Unknown command: " + strCmd;
Modified: trunk/java/org/apache/catalina/ssi/SSIServlet.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIServlet.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/ssi/SSIServlet.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -25,6 +25,8 @@
import java.io.StringWriter;
import java.net.URL;
import java.net.URLConnection;
+import java.util.Locale;
+
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -144,8 +146,8 @@
+ path + "'");
// Exclude any resource in the /WEB-INF and /META-INF subdirectories
// (the "toUpperCase()" avoids problems on Windows systems)
- if (path == null || path.toUpperCase().startsWith("/WEB-INF")
- || path.toUpperCase().startsWith("/META-INF")) {
+ if (path == null || path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF")
+ || path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF")) {
res.sendError(HttpServletResponse.SC_NOT_FOUND, path);
log("Can't serve file: " + path);
return;
Modified: trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -25,6 +25,8 @@
import java.util.Collection;
import java.util.Date;
import java.util.Enumeration;
+import java.util.Locale;
+
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -149,7 +151,7 @@
protected String getCGIVariable(String name) {
String retVal = null;
- String[] nameParts = name.toUpperCase().split("_");
+ String[] nameParts = name.toUpperCase(Locale.ENGLISH).split("_");
int requiredParts = 2;
if (nameParts.length == 1) {
if (nameParts[0].equals("PATH")) {
Modified: trunk/java/org/apache/catalina/util/ExtensionValidator.java
===================================================================
--- trunk/java/org/apache/catalina/util/ExtensionValidator.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/util/ExtensionValidator.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -23,6 +23,7 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.Locale;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.jar.JarInputStream;
@@ -87,7 +88,7 @@
// build a list of jar files in the classpath
while (strTok.hasMoreTokens()) {
String classpathItem = strTok.nextToken();
- if (classpathItem.toLowerCase().endsWith(".jar")) {
+ if (classpathItem.toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
File item = new File(classpathItem);
if (item.exists()) {
try {
@@ -142,7 +143,7 @@
try {
NamingEnumeration wne = dirContext.listBindings("/META-INF/");
Binding binding = (Binding) wne.nextElement();
- if (binding.getName().toUpperCase().equals("MANIFEST.MF")) {
+ if (binding.getName().toUpperCase(Locale.ENGLISH).equals("MANIFEST.MF")) {
Resource resource = (Resource)dirContext.lookup
("/META-INF/" + binding.getName());
inputStream = resource.streamContent();
@@ -176,7 +177,7 @@
}
while ((ne != null) && ne.hasMoreElements()) {
Binding binding = (Binding)ne.nextElement();
- if (!binding.getName().toLowerCase().endsWith(".jar")) {
+ if (!binding.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
continue;
}
Object resourceObject = dirContext.lookup("/WEB-INF/lib/" + binding.getName());
@@ -407,7 +408,7 @@
}
File[] files = targetDir.listFiles();
for (int i = 0; i < files.length; i++) {
- if (files[i].getName().toLowerCase().endsWith(".jar")) {
+ if (files[i].getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
try {
addSystemResource(files[i]);
} catch (IOException e) {
Modified: trunk/java/org/apache/catalina/util/MIME2Java.java
===================================================================
--- trunk/java/org/apache/catalina/util/MIME2Java.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/util/MIME2Java.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -580,7 +580,7 @@
* @see #reverse
*/
public static String convert(String mimeCharsetName) {
- return (String)s_enchash.get(mimeCharsetName.toUpperCase());
+ return (String)s_enchash.get(mimeCharsetName.toUpperCase(Locale.ENGLISH));
}
/**
@@ -598,6 +598,6 @@
* @see #convert
*/
public static String reverse(String encoding) {
- return (String)s_revhash.get(encoding.toUpperCase());
+ return (String)s_revhash.get(encoding.toUpperCase(Locale.ENGLISH));
}
}
Modified: trunk/java/org/apache/catalina/util/URL.java
===================================================================
--- trunk/java/org/apache/catalina/util/URL.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/catalina/util/URL.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -21,6 +21,7 @@
import java.io.Serializable;
import java.net.MalformedURLException;
+import java.util.Locale;
/**
@@ -111,7 +112,7 @@
for (i = start; !aRef && (i < limit) &&
((c = spec.charAt(i)) != '/'); i++) {
if (c == ':') {
- String s = spec.substring(start, i).toLowerCase();
+ String s = spec.substring(start, i).toLowerCase(Locale.ENGLISH);
// Assume all protocols are valid
newProtocol = s;
start = i + 1;
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -20,6 +20,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
+import java.util.Locale;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -1438,7 +1439,7 @@
String encodingName = null;
while (commaPos != -1) {
encodingName = transferEncodingValue.substring
- (startPos, commaPos).toLowerCase().trim();
+ (startPos, commaPos).toLowerCase(Locale.ENGLISH).trim();
if (!addInputFilter(inputFilters, encodingName)) {
// Unsupported transfer encoding
error = true;
@@ -1449,7 +1450,7 @@
commaPos = transferEncodingValue.indexOf(',', startPos);
}
encodingName = transferEncodingValue.substring(startPos)
- .toLowerCase().trim();
+ .toLowerCase(Locale.ENGLISH).trim();
if (!addInputFilter(inputFilters, encodingName)) {
// Unsupported transfer encoding
error = true;
Modified: trunk/java/org/apache/coyote/http11/Http11Processor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Processor.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/coyote/http11/Http11Processor.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -26,6 +26,7 @@
import java.io.InterruptedIOException;
import java.net.InetAddress;
import java.net.Socket;
+import java.util.Locale;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -1330,7 +1331,7 @@
String encodingName = null;
while (commaPos != -1) {
encodingName = transferEncodingValue.substring
- (startPos, commaPos).toLowerCase().trim();
+ (startPos, commaPos).toLowerCase(Locale.ENGLISH).trim();
if (!addInputFilter(inputFilters, encodingName)) {
// Unsupported transfer encoding
error = true;
@@ -1341,7 +1342,7 @@
commaPos = transferEncodingValue.indexOf(',', startPos);
}
encodingName = transferEncodingValue.substring(startPos)
- .toLowerCase().trim();
+ .toLowerCase(Locale.ENGLISH).trim();
if (!addInputFilter(inputFilters, encodingName)) {
// Unsupported transfer encoding
error = true;
Modified: trunk/java/org/apache/jasper/compiler/Validator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Validator.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/jasper/compiler/Validator.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Locale;
import javax.el.ELException;
import javax.el.ExpressionFactory;
@@ -327,7 +328,7 @@
Node.Root root = pageDir.getRoot();
String configEnc = root.getJspConfigPageEncoding();
- String pageDirEnc = thePageDirEnc.toUpperCase();
+ String pageDirEnc = thePageDirEnc.toUpperCase(Locale.ENGLISH);
/*
* Compare the 'pageEncoding' attribute of the page directive with
@@ -336,7 +337,7 @@
* "UTF-16LE" as identical.
*/
if (configEnc != null) {
- configEnc = configEnc.toUpperCase();
+ configEnc = configEnc.toUpperCase(Locale.ENGLISH);
if (!pageDirEnc.equals(configEnc)
&& (!pageDirEnc.startsWith("UTF-16") || !configEnc
.startsWith("UTF-16"))) {
@@ -356,7 +357,7 @@
* identical.
*/
if ((root.isXmlSyntax() && root.isEncodingSpecifiedInProlog()) || root.isBomPresent()) {
- String pageEnc = root.getPageEncoding().toUpperCase();
+ String pageEnc = root.getPageEncoding().toUpperCase(Locale.ENGLISH);
if (!pageDirEnc.equals(pageEnc)
&& (!pageDirEnc.startsWith("UTF-16") || !pageEnc
.startsWith("UTF-16"))) {
Modified: trunk/java/org/apache/jasper/tagplugins/jstl/Util.java
===================================================================
--- trunk/java/org/apache/jasper/tagplugins/jstl/Util.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/jasper/tagplugins/jstl/Util.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -119,7 +119,7 @@
public static String getContentTypeAttribute(String input, String name) {
int begin;
int end;
- int index = input.toUpperCase().indexOf(name.toUpperCase());
+ int index = input.toUpperCase(Locale.ENGLISH).indexOf(name.toUpperCase(Locale.ENGLISH));
if (index == -1) return null;
index = index + name.length(); // positioned after the attribute name
index = input.indexOf('=', index); // positioned at the '='
Modified: trunk/java/org/apache/tomcat/util/buf/MessageBytes.java
===================================================================
--- trunk/java/org/apache/tomcat/util/buf/MessageBytes.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/buf/MessageBytes.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.io.Serializable;
+import java.util.Locale;
/**
* This class is used to represent a subarray of bytes in an HTTP message.
@@ -481,8 +482,8 @@
public int indexOfIgnoreCase(String s, int starting) {
toString();
- String upper=strValue.toUpperCase();
- String sU=s.toUpperCase();
+ String upper=strValue.toUpperCase(Locale.ENGLISH);
+ String sU=s.toUpperCase(Locale.ENGLISH);
return upper.indexOf( sU, starting );
}
Modified: trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -92,7 +92,7 @@
qIndex < equalIndex) {
String qValueStr = language.substring(qValueIndex + 1);
language = language.substring(0, qValueIndex);
- qValueStr = qValueStr.trim().toLowerCase();
+ qValueStr = qValueStr.trim().toLowerCase(Locale.ENGLISH);
qValueIndex = qValueStr.indexOf('=');
qValue = new Double(0);
if (qValueStr.startsWith("q") &&
Modified: trunk/java/org/apache/tomcat/util/http/MimeMap.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/MimeMap.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/http/MimeMap.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -137,7 +137,7 @@
private Hashtable map = new Hashtable();
public void addContentType(String extn, String type) {
- map.put(extn, type.toLowerCase());
+ map.put(extn, type.toLowerCase(Locale.ENGLISH));
}
public Enumeration getExtensions() {
@@ -149,13 +149,13 @@
}
public String getContentType(String extn) {
- String type = (String)map.get(extn.toLowerCase());
+ String type = (String)map.get(extn.toLowerCase(Locale.ENGLISH));
if( type == null ) type=(String)defaultMap.get( extn );
return type;
}
public void removeContentType(String extn) {
- map.remove(extn.toLowerCase());
+ map.remove(extn.toLowerCase(Locale.ENGLISH));
}
/** Get extension of file, without fragment id
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersImpl.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersImpl.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersImpl.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
@@ -49,7 +50,7 @@
private final List<String> headerNameList = new ArrayList<String>();
public String getHeader(String name) {
- String nameLower = name.toLowerCase();
+ String nameLower = name.toLowerCase(Locale.ENGLISH);
List<String> headerValueList = headerNameToValueListMap.get(nameLower);
if (null == headerValueList) {
return null;
@@ -62,7 +63,7 @@
}
public Iterator<String> getHeaders(String name) {
- String nameLower = name.toLowerCase();
+ String nameLower = name.toLowerCase(Locale.ENGLISH);
List<String> headerValueList = headerNameToValueListMap.get(nameLower);
if (null == headerValueList) {
return Collections.<String>emptyList().iterator();
@@ -77,7 +78,7 @@
* @param value value of this header
*/
public synchronized void addHeader(String name, String value) {
- String nameLower = name.toLowerCase();
+ String nameLower = name.toLowerCase(Locale.ENGLISH);
List<String> headerValueList = headerNameToValueListMap.get(nameLower);
if (null == headerValueList) {
headerValueList = new ArrayList<String>();
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -21,6 +21,7 @@
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
@@ -76,7 +77,7 @@
if (contentType == null) {
return false;
}
- if (contentType.toLowerCase().startsWith(MULTIPART)) {
+ if (contentType.toLowerCase(Locale.ENGLISH).startsWith(MULTIPART)) {
return true;
}
return false;
@@ -382,7 +383,7 @@
private String getFileName(String pContentDisposition) {
String fileName = null;
if (pContentDisposition != null) {
- String cdl = pContentDisposition.toLowerCase();
+ String cdl = pContentDisposition.toLowerCase(Locale.ENGLISH);
if (cdl.startsWith(FORM_DATA) || cdl.startsWith(ATTACHMENT)) {
ParameterParser parser = new ParameterParser();
parser.setLowerCaseNames(true);
@@ -427,7 +428,7 @@
private String getFieldName(String pContentDisposition) {
String fieldName = null;
if (pContentDisposition != null
- && pContentDisposition.toLowerCase().startsWith(FORM_DATA)) {
+ && pContentDisposition.toLowerCase(Locale.ENGLISH).startsWith(FORM_DATA)) {
ParameterParser parser = new ParameterParser();
parser.setLowerCaseNames(true);
// Parameter parser can handle null input
@@ -738,7 +739,7 @@
String contentType = ctx.getContentType();
if ((null == contentType)
- || (!contentType.toLowerCase().startsWith(MULTIPART))) {
+ || (!contentType.toLowerCase(Locale.ENGLISH).startsWith(MULTIPART))) {
throw new InvalidContentTypeException(
"the request doesn't contain a "
+ MULTIPART_FORM_DATA
@@ -838,7 +839,7 @@
if (fieldName != null) {
String subContentType = headers.getHeader(CONTENT_TYPE);
if (subContentType != null
- && subContentType.toLowerCase()
+ && subContentType.toLowerCase(Locale.ENGLISH)
.startsWith(MULTIPART_MIXED)) {
currentFieldName = fieldName;
// Multiple files associated with this field name
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/ServletFileUpload.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/ServletFileUpload.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/ServletFileUpload.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -18,6 +18,7 @@
import java.io.IOException;
import java.util.List;
+import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
@@ -61,7 +62,7 @@
*/
public static final boolean isMultipartContent(
HttpServletRequest request) {
- if (!"post".equals(request.getMethod().toLowerCase())) {
+ if (!"post".equals(request.getMethod().toLowerCase(Locale.ENGLISH))) {
return false;
}
String contentType = request.getContentType();
Modified: trunk/java/org/apache/tomcat/util/modeler/OperationInfo.java
===================================================================
--- trunk/java/org/apache/tomcat/util/modeler/OperationInfo.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/modeler/OperationInfo.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -20,6 +20,7 @@
import java.io.Serializable;
+import java.util.Locale;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
@@ -66,7 +67,7 @@
if (impact == null)
this.impact = null;
else
- this.impact = impact.toUpperCase();
+ this.impact = impact.toUpperCase(Locale.ENGLISH);
}
Modified: trunk/java/org/apache/tomcat/util/net/URL.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/URL.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/net/URL.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -20,6 +20,7 @@
import java.io.Serializable;
import java.net.MalformedURLException;
+import java.util.Locale;
/**
@@ -110,7 +111,7 @@
for (i = start; !aRef && (i < limit) ; i++) {
c = spec.charAt(i);
if (c == ':') {
- String s = spec.substring(start, i).toLowerCase();
+ String s = spec.substring(start, i).toLowerCase(Locale.ENGLISH);
// Assume all protocols are valid
newProtocol = s;
start = i + 1;
Modified: trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -39,6 +39,7 @@
import java.security.cert.PKIXBuilderParameters;
import java.security.cert.X509CertSelector;
import java.util.Collection;
+import java.util.Locale;
import java.util.Vector;
import javax.net.ssl.CertPathTrustManagerParameters;
@@ -511,7 +512,7 @@
kms = kmf.getKeyManagers();
if (keyAlias != null) {
if (JSSESocketFactory.defaultKeystoreType.equals(keystoreType)) {
- keyAlias = keyAlias.toLowerCase();
+ keyAlias = keyAlias.toLowerCase(Locale.ENGLISH);
}
for(int i=0; i<kms.length; i++) {
kms[i] = new JSSEKeyManager((X509KeyManager)kms[i], keyAlias);
Modified: trunk/java/org/jboss/web/php/ScriptEnvironment.java
===================================================================
--- trunk/java/org/jboss/web/php/ScriptEnvironment.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/jboss/web/php/ScriptEnvironment.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Locale;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -468,7 +469,7 @@
while (headers.hasMoreElements()) {
header = null;
- header = ((String)headers.nextElement()).toUpperCase();
+ header = ((String)headers.nextElement()).toUpperCase(Locale.ENGLISH);
//REMIND: rewrite multiple headers as if received as single
//REMIND: change character set
//REMIND: I forgot what the previous REMIND means
Modified: trunk/java/org/jboss/web/rewrite/RewriteCond.java
===================================================================
--- trunk/java/org/jboss/web/rewrite/RewriteCond.java 2010-05-17 09:28:32 UTC (rev 1472)
+++ trunk/java/org/jboss/web/rewrite/RewriteCond.java 2010-05-17 17:46:58 UTC (rev 1473)
@@ -23,6 +23,7 @@
package org.jboss.web.rewrite;
+import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -197,7 +198,7 @@
public boolean evaluate(Matcher rule, Matcher cond, Resolver resolver) {
String value = test.evaluate(rule, cond, resolver);
if (nocase) {
- value = value.toLowerCase();
+ value = value.toLowerCase(Locale.ENGLISH);
}
Condition condition = this.condition.get();
if (condition == null) {
14 years, 7 months
JBossWeb SVN: r1472 - in sandbox/webapps: src and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2010-05-17 05:28:32 -0400 (Mon, 17 May 2010)
New Revision: 1472
Modified:
sandbox/webapps/myapp.xml
sandbox/webapps/src/TestServlet.java
Log:
See http://labs.jboss.com/file-access/default/members/jbossweb/freezone/docs/...
Modified: sandbox/webapps/myapp.xml
===================================================================
--- sandbox/webapps/myapp.xml 2010-05-11 08:49:03 UTC (rev 1471)
+++ sandbox/webapps/myapp.xml 2010-05-17 09:28:32 UTC (rev 1472)
@@ -209,4 +209,10 @@
<role-name>manager</role-name>
</security-role>
+ <env-entry>
+ <env-entry-name>test</env-entry-name>
+ <env-entry-value>Toto</env-entry-value>
+ <env-entry-type>java.lang.String</env-entry-type>
+ </env-entry>
+
</web-app>
Modified: sandbox/webapps/src/TestServlet.java
===================================================================
--- sandbox/webapps/src/TestServlet.java 2010-05-11 08:49:03 UTC (rev 1471)
+++ sandbox/webapps/src/TestServlet.java 2010-05-17 09:28:32 UTC (rev 1472)
@@ -29,6 +29,9 @@
import javax.servlet.*;
import javax.servlet.http.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
/**
@@ -98,6 +101,19 @@
response.addHeader("", "empty");
return;
}
+ if (testValue != null && testValue.compareToIgnoreCase("JNDI")==0) {
+ out.println("<p>JNDI: <br/>");
+ try {
+ Context initCtx = new InitialContext();
+ Context envCtx = (Context) initCtx.lookup("java:comp/env");
+ String value = (String) envCtx.lookup("test");
+ out.println("JNDI test: " + value);
+ envCtx.close();
+ } catch (NamingException ne) {
+ out.println("JNDI test exception: " + ne);
+ }
+ out.println("</p>");
+ }
String createValue = request.getParameter("create");
int icreate = 0;
@@ -171,6 +187,7 @@
out.println("param: countvalue " + countValue + " counted: " + l);
out.println("param: waitvalue " + waitValue);
out.println("param: create " + createValue);
+ out.println("param: test " + testValue);
out.println("param: errcodevalue " + errcodeValue);
out.println("negative errcodevalue should display the error page (404.html)");
out.println("<P>");
14 years, 7 months
JBossWeb SVN: r1471 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-11 04:49:03 -0400 (Tue, 11 May 2010)
New Revision: 1471
Modified:
trunk/java/org/apache/catalina/core/LocalStrings.properties
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/webapps/docs/changelog.xml
Log:
- Improve createWrapper error reporting, as reported by Carlo.
Modified: trunk/java/org/apache/catalina/core/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/core/LocalStrings.properties 2010-05-07 22:48:28 UTC (rev 1470)
+++ trunk/java/org/apache/catalina/core/LocalStrings.properties 2010-05-11 08:49:03 UTC (rev 1471)
@@ -82,6 +82,7 @@
standardContext.applicationListener=Error configuring application listener of class {0}
standardContext.applicationSkipped=Skipped installing application listeners due to previous error(s)
standardContext.badRequest=Invalid request path ({0}).
+standardContext.createWrapper.failed=Create wrapper failed.
standardContext.crlfinurl=The URL pattern "{0}" contains a CR or LF and so can never be matched.
standardContext.duplicateListener=The listener "{0}" is already configured for this context. The duplicate definition has been ignored.
standardContext.errorPage.error=Error page location {0} must start with a ''/''
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2010-05-07 22:48:28 UTC (rev 1470)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2010-05-11 08:49:03 UTC (rev 1471)
@@ -2313,8 +2313,7 @@
try {
wrapper = (Wrapper) wrapperClass.newInstance();
} catch (Throwable t) {
- log.error("createWrapper", t);
- return (null);
+ throw new IllegalStateException(sm.getString("standardContext.createWrapper.failed"), t);
}
} else {
wrapper = new StandardWrapper();
@@ -2327,8 +2326,7 @@
(InstanceListener) clazz.newInstance();
wrapper.addInstanceListener(listener);
} catch (Throwable t) {
- log.error("createWrapper", t);
- return (null);
+ throw new IllegalStateException(sm.getString("standardContext.createWrapper.failed"), t);
}
}
@@ -2340,8 +2338,7 @@
if (wrapper instanceof Lifecycle)
((Lifecycle) wrapper).addLifecycleListener(listener);
} catch (Throwable t) {
- log.error("createWrapper", t);
- return (null);
+ throw new IllegalStateException(sm.getString("standardContext.createWrapper.failed"), t);
}
}
@@ -2352,8 +2349,7 @@
(ContainerListener) clazz.newInstance();
wrapper.addContainerListener(listener);
} catch (Throwable t) {
- log.error("createWrapper", t);
- return (null);
+ throw new IllegalStateException(sm.getString("standardContext.createWrapper.failed"), t);
}
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2010-05-07 22:48:28 UTC (rev 1470)
+++ trunk/webapps/docs/changelog.xml 2010-05-11 08:49:03 UTC (rev 1471)
@@ -38,6 +38,9 @@
<add>
Add csrf filter for compatibility with Tomcat. (markt)
</add>
+ <fix>
+ Improve StandardWrapper.createWrapper error reporting. (remm)
+ </fix>
</changelog>
</subsection>
</section>
14 years, 7 months
JBossWeb SVN: r1470 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-07 18:48:28 -0400 (Fri, 07 May 2010)
New Revision: 1470
Added:
trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java
Modified:
trunk/java/org/apache/catalina/filters/Constants.java
trunk/webapps/docs/changelog.xml
Log:
- Add CSRF filter for compatibility. Looks slow though.
Modified: trunk/java/org/apache/catalina/filters/Constants.java
===================================================================
--- trunk/java/org/apache/catalina/filters/Constants.java 2010-05-07 13:13:29 UTC (rev 1469)
+++ trunk/java/org/apache/catalina/filters/Constants.java 2010-05-07 22:48:28 UTC (rev 1470)
@@ -31,4 +31,9 @@
public static final String Package = "org.apache.catalina.filters";
+ public static final String CSRF_NONCE_SESSION_ATTR_NAME =
+ "org.apache.catalina.filters.CSRF_NONCE";
+
+ public static final String CSRF_NONCE_REQUEST_PARAM =
+ "org.apache.catalina.filters.CSRF_NONCE";
}
Added: trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java
===================================================================
--- trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java (rev 0)
+++ trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java 2010-05-07 22:48:28 UTC (rev 1470)
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.filters;
+
+import java.io.IOException;
+import java.util.Random;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * Provides basic CSRF protection for a web application. The filter assumes
+ * that:
+ * <ul>
+ * <li>The filter is mapped to /*</li>
+ * <li>{@link HttpServletResponse#encodeRedirectURL(String)} and
+ * {@link HttpServletResponse#encodeURL(String)} are used to encode all URLs
+ * returned to the client
+ * </ul>
+ */
+public class CsrfPreventionFilter extends FilterBase {
+
+ private final Random randomSource = new Random();
+
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ ServletResponse wResponse = null;
+
+ if (request instanceof HttpServletRequest &&
+ response instanceof HttpServletResponse) {
+
+ HttpServletRequest req = (HttpServletRequest) request;
+ HttpServletResponse res = (HttpServletResponse) response;
+
+ String previousNonce =
+ req.getParameter(Constants.CSRF_NONCE_REQUEST_PARAM);
+ String expectedNonce = (String) req.getSession(true).getAttribute(
+ Constants.CSRF_NONCE_SESSION_ATTR_NAME);
+
+ if (expectedNonce != null && !expectedNonce.equals(previousNonce)) {
+ res.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+
+ String newNonce = generateNonce();
+
+ req.getSession(true).setAttribute(
+ Constants.CSRF_NONCE_SESSION_ATTR_NAME, newNonce);
+
+ wResponse = new CsrfResponseWrapper(res, newNonce);
+ } else {
+ wResponse = response;
+ }
+
+ chain.doFilter(request, wResponse);
+ }
+
+ /**
+ * Generate a once time token (nonce) for authenticating subsequent
+ * requests. This will also add the token to the session. The nonce
+ * generation is a simplified version of ManagerBase.generateSessionId().
+ *
+ */
+ protected String generateNonce() {
+ byte random[] = new byte[16];
+
+ // Render the result as a String of hexadecimal digits
+ StringBuilder buffer = new StringBuilder();
+
+ randomSource.nextBytes(random);
+
+ for (int j = 0; j < random.length; j++) {
+ byte b1 = (byte) ((random[j] & 0xf0) >> 4);
+ byte b2 = (byte) (random[j] & 0x0f);
+ if (b1 < 10)
+ buffer.append((char) ('0' + b1));
+ else
+ buffer.append((char) ('A' + (b1 - 10)));
+ if (b2 < 10)
+ buffer.append((char) ('0' + b2));
+ else
+ buffer.append((char) ('A' + (b2 - 10)));
+ }
+
+ return buffer.toString();
+ }
+
+ private static class CsrfResponseWrapper
+ extends HttpServletResponseWrapper {
+
+ private String nonce;
+
+ public CsrfResponseWrapper(HttpServletResponse response, String nonce) {
+ super(response);
+ this.nonce = nonce;
+ }
+
+ @Override
+ @Deprecated
+ public String encodeRedirectUrl(String url) {
+ return encodeRedirectURL(url);
+ }
+
+ @Override
+ public String encodeRedirectURL(String url) {
+ return addNonce(super.encodeRedirectURL(url));
+ }
+
+ @Override
+ @Deprecated
+ public String encodeUrl(String url) {
+ return encodeURL(url);
+ }
+
+ @Override
+ public String encodeURL(String url) {
+ return addNonce(super.encodeURL(url));
+ }
+
+ /**
+ * Return the specified URL with the nonce added to the query string
+ *
+ * @param url URL to be modified
+ * @param nonce The nonce to add
+ */
+ private String addNonce(String url) {
+
+ if ((url == null) || (nonce == null))
+ return (url);
+
+ String path = url;
+ String query = "";
+ String anchor = "";
+ int question = url.indexOf('?');
+ if (question >= 0) {
+ path = url.substring(0, question);
+ query = url.substring(question);
+ }
+ int pound = path.indexOf('#');
+ if (pound >= 0) {
+ anchor = path.substring(pound);
+ path = path.substring(0, pound);
+ }
+ StringBuilder sb = new StringBuilder(path);
+ sb.append(anchor);
+ if (query.length() >0) {
+ sb.append(query);
+ sb.append('&');
+ } else {
+ sb.append('?');
+ }
+ sb.append(Constants.CSRF_NONCE_REQUEST_PARAM);
+ sb.append('=');
+ sb.append(nonce);
+ return (sb.toString());
+ }
+ }
+}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2010-05-07 13:13:29 UTC (rev 1469)
+++ trunk/webapps/docs/changelog.xml 2010-05-07 22:48:28 UTC (rev 1470)
@@ -35,6 +35,9 @@
<update>
More standalone code removal (incl system streams swallowing). (remm)
</update>
+ <add>
+ Add csrf filter for compatibility with Tomcat. (markt)
+ </add>
</changelog>
</subsection>
</section>
14 years, 8 months
JBossWeb SVN: r1469 - trunk/java/org/apache/catalina.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2010-05-07 09:13:29 -0400 (Fri, 07 May 2010)
New Revision: 1469
Modified:
trunk/java/org/apache/catalina/InstanceEvent.java
Log:
- Expose request and response through event.
Modified: trunk/java/org/apache/catalina/InstanceEvent.java
===================================================================
--- trunk/java/org/apache/catalina/InstanceEvent.java 2010-05-07 12:38:52 UTC (rev 1468)
+++ trunk/java/org/apache/catalina/InstanceEvent.java 2010-05-07 13:13:29 UTC (rev 1469)
@@ -527,7 +527,11 @@
*/
public ServletRequest getRequest() {
- return (this.request);
+ if (event != null) {
+ return this.event.getHttpServletRequest();
+ } else {
+ return (this.request);
+ }
}
@@ -537,7 +541,11 @@
*/
public ServletResponse getResponse() {
- return (this.response);
+ if (event != null) {
+ return this.event.getHttpServletResponse();
+ } else {
+ return (this.response);
+ }
}
14 years, 8 months