@SuppressWarnings("unused") // Part of public API public URI getWsListener() { try { return WSURI.toWebsocket(getHttpListener()); } catch (URISyntaxException e) { throw new RuntimeException("Invalid WS listener", e); } }
/** * Create an iterator of the input string, breaking apart the string at the provided delimiters, removing quotes and triming the parts of the string as * needed. * * @param str * the input string to split apart * @param delims * the delimiter characters to split the string on * @return the iterator of the parts of the string, trimmed, with quotes around the string part removed, and unescaped */ public static Iterator<String> splitAt(String str, String delims) { return new DeQuotingStringIterator(str.trim(),delims); }
public String getParameterizedName() { StringBuilder str = new StringBuilder(); str.append(name); for (String param : parameters.keySet()) { str.append(';'); str.append(param); str.append('='); QuoteUtil.quoteIfNeeded(str,parameters.get(param),";="); } return str.toString(); }
public static ExtensionConfig parse(String parameterizedName) { Iterator<String> extListIter = QuoteUtil.splitAt(parameterizedName,";"); String extToken = extListIter.next(); ExtensionConfig ext = new ExtensionConfig(extToken); // now for parameters while (extListIter.hasNext()) { String extParam = extListIter.next(); Iterator<String> extParamIter = QuoteUtil.splitAt(extParam,"="); String key = extParamIter.next().trim(); String value = null; if (extParamIter.hasNext()) { value = extParamIter.next(); } ext.setParameter(key,value); } return ext; }
/** * Simple quote of a string, escaping where needed. * * @param buf * the StringBuilder to append to * @param str * the string to quote */ public static void quote(StringBuilder buf, String str) { buf.append('"'); escape(buf,str); buf.append('"'); }
private String getHeaderValue(HandshakeRequest request, String key) { List<String> value = request.getHeaders().get(key); return QuoteUtil.join(value, ","); }
public String getParameterizedName() { StringBuilder str = new StringBuilder(); str.append(name); for (String param : parameters.keySet()) { str.append(';'); str.append(param); str.append('='); QuoteUtil.quoteIfNeeded(str,parameters.get(param),";="); } return str.toString(); }
public static ExtensionConfig parse(String parameterizedName) { Iterator<String> extListIter = QuoteUtil.splitAt(parameterizedName,";"); String extToken = extListIter.next(); ExtensionConfig ext = new ExtensionConfig(extToken); // now for parameters while (extListIter.hasNext()) { String extParam = extListIter.next(); Iterator<String> extParamIter = QuoteUtil.splitAt(extParam,"="); String key = extParamIter.next().trim(); String value = null; if (extParamIter.hasNext()) { value = extParamIter.next(); } ext.setParameter(key,value); } return ext; }
/** * Simple quote of a string, escaping where needed. * * @param buf * the StringBuilder to append to * @param str * the string to quote */ public static void quote(StringBuilder buf, String str) { buf.append('"'); escape(buf,str); buf.append('"'); }
/** * Create an iterator of the input string, breaking apart the string at the provided delimiters, removing quotes and triming the parts of the string as * needed. * * @param str * the input string to split apart * @param delims * the delimiter characters to split the string on * @return the iterator of the parts of the string, trimmed, with quotes around the string part removed, and unescaped */ public static Iterator<String> splitAt(String str, String delims) { return new DeQuotingStringIterator(str.trim(),delims); }
LOG.warn("Client requested Subprotocols on endpoint with none supported: {}",QuoteUtil.join(requested,",")); return NO_SUBPROTOCOL; LOG.warn("Client requested subprotocols {} do not match any endpoint supported subprotocols {}",QuoteUtil.join(requested,","), QuoteUtil.join(supported,",")); return NO_SUBPROTOCOL;
@SuppressWarnings("unused") // Part of public API public URI getWssListener() { try { return WSURI.toWebsocket(getHttpsListener()); } catch (URISyntaxException e) { throw new RuntimeException("Invalid WS listener", e); } }
public final String getParameterizedName() { StringBuilder str = new StringBuilder(); str.append(name); for (String param : parameters.keySet()) { str.append(';'); str.append(param); String value = parameters.get(param); if (value != null) { str.append('='); QuoteUtil.quoteIfNeeded(str,value,";="); } } return str.toString(); }
/** * Simple quote of a string, escaping where needed. * * @param buf * the StringBuilder to append to * @param str * the string to quote */ public static void quote(StringBuilder buf, String str) { buf.append('"'); escape(buf,str); buf.append('"'); }
/** * Create an iterator of the input string, breaking apart the string at the provided delimiters, removing quotes and triming the parts of the string as * needed. * * @param str * the input string to split apart * @param delims * the delimiter characters to split the string on * @return the iterator of the parts of the string, trimmed, with quotes around the string part removed, and unescaped */ public static Iterator<String> splitAt(String str, String delims) { return new DeQuotingStringIterator(str.trim(),delims); }
/** * Convert to WebSocket <code>ws</code> or <code>wss</code> scheme URIs * <p> * Converting <code>http</code> and <code>https</code> URIs to their WebSocket equivalent * * @param inputUrl * the input URI * @return the WebSocket scheme URI for the input URI. * @throws URISyntaxException * if unable to convert the input URI */ public static URI toWebsocket(CharSequence inputUrl) throws URISyntaxException { return toWebsocket(new URI(inputUrl.toString())); }
/** * Convert to WebSocket <code>ws</code> or <code>wss</code> scheme URIs * <p> * Converting <code>http</code> and <code>https</code> URIs to their WebSocket equivalent * * @param inputUrl * the input URI * @param query * the optional query string * @return the WebSocket scheme URI for the input URI. * @throws URISyntaxException * if unable to convert the input URI */ public static URI toWebsocket(CharSequence inputUrl, String query) throws URISyntaxException { if (query == null) { return toWebsocket(new URI(inputUrl.toString())); } return toWebsocket(new URI(inputUrl.toString() + '?' + query)); }