axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r479077 - in /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2: transport/http/HTTPTransportUtils.java util/JavaUtils.java
Date Sat, 25 Nov 2006 03:23:19 GMT
Author: dims
Date: Fri Nov 24 19:23:18 2006
New Revision: 479077

URL: http://svn.apache.org/viewvc?view=rev&rev=479077
Log:
Part of AXIS2-1769 - trying  to avoid toLowerCase() and then indexOf

Modified:
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?view=diff&rev=479077&r1=479076&r2=479077
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
Fri Nov 24 19:23:18 2006
@@ -199,7 +199,7 @@
                 } else if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >
-1) {
                     soapVersion = VERSION_SOAP11;
                 }
-                if (contentType.toLowerCase().indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)
> -1) {
+                if (JavaUtils.indexOfIgnoreCase(contentType, HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)
> -1) {
                     // It is MIME (MTOM or SwA)
                     builder = TransportUtils.selectBuilderForMIME(msgContext, in, contentType,true);
                     envelope = (SOAPEnvelope) builder.getDocumentElement();

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java?view=diff&rev=479077&r1=479076&r2=479077
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
Fri Nov 24 19:23:18 2006
@@ -399,4 +399,43 @@
         
         return null;
     }
+
+	/**
+	 * Scans the parameter string for the parameter search ignoring case when
+	 * comparing characters.
+	 *
+	 * @param string
+	 * @param search
+	 *            If test is empty -1 is always returned.
+	 * @return -1 if the string was not found or the index of the first matching
+	 *         character
+	 */
+	public static int indexOfIgnoreCase(final String string,
+			final String search) {
+		int index = -1;
+		final int stringLength = string.length();
+		final int testLength = search.length();
+		if (stringLength > 1 || testLength > 1) {
+			final char firstCharOfTest = Character.toLowerCase(search.charAt(0));
+			final int lastStringCharacterToCheck = stringLength - testLength + 1;
+
+			for (int i = 0; i < lastStringCharacterToCheck; i++) {
+				if (firstCharOfTest == Character.toLowerCase(string.charAt(i))) {
+					index = i;
+					for (int j = 1; j < testLength; j++) {
+						final char c = string.charAt(i + j);
+						final char otherChar = search.charAt(j);
+						if (Character.toLowerCase(c) != Character.toLowerCase(otherChar)) {
+							index = -1;
+							break;
+						}
+					}
+					if( -1 != index ){
+						break;
+					}
+				}
+			}
+		}
+		return index;
+	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message