[sword-svn] r247 - in trunk/src: . org/crosswire
org/crosswire/utils org/crosswire/web
scribe at crosswire.org
scribe at crosswire.org
Tue Apr 25 02:30:59 MST 2006
Author: scribe
Date: 2006-04-25 02:30:58 -0700 (Tue, 25 Apr 2006)
New Revision: 247
Added:
trunk/src/org/crosswire/utils/
trunk/src/org/crosswire/utils/HTTPUtils.java
Removed:
trunk/src/org/crosswire/web/util/
Modified:
trunk/src/Makefile
Log:
Using package from crosswire-java
Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile 2006-04-25 07:48:05 UTC (rev 246)
+++ trunk/src/Makefile 2006-04-25 09:30:58 UTC (rev 247)
@@ -4,7 +4,7 @@
all: ${instdir}/WEB-INF/classes/org/crosswire/web/i18n/TranslateTag.class
${instdir}/WEB-INF/classes/org/crosswire/web/i18n/TranslateTag.class: org/crosswire/web/i18n/TranslateTag.java
- javac -classpath ${TOMCAT_HOME}/common/lib/jsp-api.jar:${TOMCAT_HOME}/common/lib/servlet-api.jar:${instdir}/WEB-INF/classes:${instdir}/WEB-INF/lib/greekconverter.jar -d ${instdir}/WEB-INF/classes -sourcepath . ./org/crosswire/web/i18n/*.java ./org/crosswire/web/util/*.java ./org/crosswire/swordweb/*.java
+ javac -classpath ${TOMCAT_HOME}/common/lib/jsp-api.jar:${TOMCAT_HOME}/common/lib/servlet-api.jar:${instdir}/WEB-INF/classes:${instdir}/WEB-INF/lib/greekconverter.jar -d ${instdir}/WEB-INF/classes -sourcepath . ./org/crosswire/web/i18n/*.java ./org/crosswire/utils/*.java ./org/crosswire/swordweb/*.java
clean:
rm -rf ${instdir}/WEB-INF/classes/org/crosswire/web/*
Added: trunk/src/org/crosswire/utils/HTTPUtils.java
===================================================================
--- trunk/src/org/crosswire/utils/HTTPUtils.java 2006-04-25 07:48:05 UTC (rev 246)
+++ trunk/src/org/crosswire/utils/HTTPUtils.java 2006-04-25 09:30:58 UTC (rev 247)
@@ -0,0 +1,109 @@
+/*
+ * SOME METHODS:
+ *
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 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 "Xerces" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache at apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * 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 and was
+ * originally based on software copyright (c) 1999, International
+ * Business Machines, Inc., http://www.apache.org. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ * ---------------------------------------------------------------------------
+ *
+ * OTHER METHOD:
+ * (C) Copyright 2001, CrossWire Bible Society, under the terms of the GNU
+ * General Public License
+ *
+ */
+
+package org.crosswire.utils;
+
+public class HTTPUtils {
+ /** Normalizes the given string. */
+ public static String canonize(String s) {
+ StringBuffer str = new StringBuffer();
+
+ int len = (s != null) ? s.length() : 0;
+ for ( int i = 0; i < len; i++ ) {
+ char ch = s.charAt(i);
+ switch ( ch ) {
+ case '<': {
+ str.append("<");
+ break;
+ }
+ case '>': {
+ str.append(">");
+ break;
+ }
+ case '&': {
+ str.append("&");
+ break;
+ }
+ case '"': {
+ str.append(""");
+ break;
+ }
+ case '\r':
+ case '\n': {
+ str.append("&#");
+ str.append(Integer.toString(ch));
+ str.append(';');
+ break;
+ }
+ default: {
+ str.append(ch);
+ }
+ }
+ }
+
+ return (str.toString());
+
+ }
+}
More information about the sword-cvs
mailing list