Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-websocket/websocket-api/src')
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java
index 2e17cef9b3..eed6f20ed1 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java
@@ -18,8 +18,8 @@
package org.eclipse.jetty.websocket.api.util;
-import java.io.IOException;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -473,4 +473,31 @@ public class QuoteUtil
}
return ret.toString();
}
+
+ public static String join(Collection<?> objs, String delim)
+ {
+ if (objs == null)
+ {
+ return "";
+ }
+ StringBuilder ret = new StringBuilder();
+ boolean needDelim = false;
+ for (Object obj : objs)
+ {
+ if (needDelim)
+ {
+ ret.append(delim);
+ }
+ if (obj instanceof String)
+ {
+ ret.append('"').append(obj).append('"');
+ }
+ else
+ {
+ ret.append(obj);
+ }
+ needDelim = true;
+ }
+ return ret.toString();
+ }
}

Back to the top