[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util ...
Christian Bauer
christian at hibernate.org
Tue Jun 12 08:30:01 EDT 2007
User: cbauer
Date: 07/06/12 08:30:01
Modified: examples/wiki/src/main/org/jboss/seam/wiki/util
WikiUtil.java
Added: examples/wiki/src/main/org/jboss/seam/wiki/util
Progress.java
Log:
Completed first iteration of search engine
Revision Changes Path
1.7 +22 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiUtil.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- WikiUtil.java 26 Apr 2007 05:29:18 -0000 1.6
+++ WikiUtil.java 12 Jun 2007 12:30:01 -0000 1.7
@@ -119,6 +119,28 @@
}
}
+ public static String escapeHtml(String string) {
+ if (string == null) return null;
+ StringBuffer sb = new StringBuffer();
+ String htmlEntity;
+ char c;
+ for (int i = 0; i < string.length(); ++i) {
+ htmlEntity = null;
+ c = string.charAt(i);
+ switch (c) {
+ case '<': htmlEntity = "<"; break;
+ case '>': htmlEntity = ">"; break;
+ case '&': htmlEntity = "&"; break;
+ case '"': htmlEntity = """; break;
+ }
+ if (htmlEntity != null) {
+ sb.append(htmlEntity);
+ } else {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
public static Throwable unwrap(Throwable throwable) throws IllegalArgumentException {
if (throwable == null) {
1.1 date: 2007/06/12 12:30:01; author: cbauer; state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/Progress.java
Index: Progress.java
===================================================================
package org.jboss.seam.wiki.util;
/**
* Convenience value holder, used mostly for asynchronous background operation status.
*
* @author Christian Bauer
*/
public class Progress {
public static final String COMPLETE = "Complete";
private int percentComplete;
private String status;
private String ofOperation;
public Progress() {}
public Progress(String ofOperation) {
this.ofOperation = ofOperation;
}
public int getPercentComplete() {
return percentComplete;
}
public void setPercentComplete(int percentComplete) {
this.percentComplete = percentComplete;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getOfOperation() {
return ofOperation;
}
public void setOfOperation(String ofOperation) {
this.ofOperation = ofOperation;
}
public String toString() {
return getOfOperation() + "(" + getStatus() + "): " + getPercentComplete() + "%";
}
}
More information about the jboss-cvs-commits
mailing list