public String getNamespace() { if (StringUtil.isNotBlank(namespace)) { return namespace; } return DEFAULT_RESOURCE_NAMESAPCE; }
/** * If a servlet or filter path mapping isn't a suffix mapping, ensure * it starts with '/' * * @param pathSpec the servlet or filter mapping pattern * @return the pathSpec prefixed by '/' if appropriate */ public static String normalize(String pathSpec) { if (StringUtil.isNotBlank(pathSpec) && !pathSpec.startsWith("/") && !pathSpec.startsWith("*")) return "/" + pathSpec; return pathSpec; }
/** * If a servlet or filter path mapping isn't a suffix mapping, ensure * it starts with '/' * * @param pathSpec the servlet or filter mapping pattern * @return the pathSpec prefixed by '/' if appropriate */ public static String normalize(String pathSpec) { if (StringUtil.isNotBlank(pathSpec) && !pathSpec.startsWith("/") && !pathSpec.startsWith("*")) return "/" + pathSpec; return pathSpec; }
static void validateDisplaySizeIfNotNull(String displaySize, List<String> validationErrors) { if (isNotBlank(displaySize) && (!NumericValidator.isValid(displaySize) || Integer.valueOf(displaySize) < 1 || Integer.valueOf(displaySize) > 500)) { validationErrors.add("display_size"); } }
static void validatePageIfNotNull(String pageNumber, List<String> validationErrors) { if (isNotBlank(pageNumber) && (!NumericValidator.isValid(pageNumber) || Integer.valueOf(pageNumber) < 1)) { validationErrors.add("page"); } }
private byte[] asByteBuffer() { if ((statusCode == StatusCode.NO_CLOSE) || (statusCode == StatusCode.NO_CODE) || (statusCode == (-1))) { // codes that are not allowed to be used in endpoint. return null; } int len = 2; // status code byte utf[] = null; if (StringUtil.isNotBlank(reason)) { utf = StringUtil.getUtf8Bytes(reason); len += utf.length; } byte buf[] = new byte[len]; buf[0] = (byte)((statusCode >>> 8) & 0xFF); buf[1] = (byte)((statusCode >>> 0) & 0xFF); if (utf != null) { System.arraycopy(utf,0,buf,2,utf.length); } return buf; }
private byte[] asByteBuffer() { if ((statusCode == StatusCode.NO_CLOSE) || (statusCode == StatusCode.NO_CODE) || (statusCode == (-1))) { // codes that are not allowed to be used in endpoint. return null; } int len = 2; // status code byte utf[] = null; if (StringUtil.isNotBlank(reason)) { utf = StringUtil.getUtf8Bytes(reason); len += utf.length; } byte buf[] = new byte[len]; buf[0] = (byte)((statusCode >>> 8) & 0xFF); buf[1] = (byte)((statusCode >>> 0) & 0xFF); if (utf != null) { System.arraycopy(utf,0,buf,2,utf.length); } return buf; }
public ByteBuffer asByteBuffer() { if ((statusCode == StatusCode.NO_CLOSE) || (statusCode == StatusCode.NO_CODE) || (statusCode == (-1))) { // codes that are not allowed to be used in endpoint. return null; } ByteBuffer buf = ByteBuffer.allocate(WebSocketFrame.MAX_CONTROL_PAYLOAD); buf.putChar((char)statusCode); if (StringUtil.isNotBlank(reason)) { byte utf[] = StringUtil.getUtf8Bytes(reason); buf.put(utf,0,utf.length); } BufferUtil.flipToFlush(buf,0); return buf; }
if ((cause != null) && (StringUtil.isNotBlank(cause.getMessage()))) if (StringUtil.isNotBlank(t.getMessage()))
if ((cause != null) && (StringUtil.isNotBlank(cause.getMessage()))) if (StringUtil.isNotBlank(t.getMessage()))
private static void setBuildName(JavascriptExecutor webDriver) { // this code does not have tests (faking an env variable was not worth the trouble) String lastCommitHash = System.getenv("CI_COMMIT_ID"); if (isNotBlank(lastCommitHash)) { webDriver.executeScript("sauce:job-build=" + lastCommitHash); } }
public WebSocketSession(URI requestURI, EventDriver websocket, LogicalConnection connection) { if (requestURI == null) { throw new RuntimeException("Request URI cannot be null"); } this.requestURI = requestURI; this.websocket = websocket; this.connection = connection; this.outgoingHandler = connection; this.incomingHandler = websocket; // Get the parameter map (use the jetty MultiMap to do this right) MultiMap<String> params = new MultiMap<>(); String query = requestURI.getQuery(); if (StringUtil.isNotBlank(query)) { UrlEncoded.decodeTo(query,params,StringUtil.__UTF8_CHARSET,-1); } for (String name : params.keySet()) { List<String> valueList = params.getValues(name); String valueArr[] = new String[valueList.size()]; valueArr = valueList.toArray(valueArr); parameterMap.put(name,valueArr); } }
public WebSocketSession(URI requestURI, EventDriver websocket, LogicalConnection connection) { if (requestURI == null) { throw new RuntimeException("Request URI cannot be null"); } this.requestURI = requestURI; this.websocket = websocket; this.connection = connection; this.outgoingHandler = connection; this.incomingHandler = websocket; // Get the parameter map (use the jetty MultiMap to do this right) MultiMap<String> params = new MultiMap<>(); String query = requestURI.getQuery(); if (StringUtil.isNotBlank(query)) { UrlEncoded.decodeTo(query,params,StringUtil.__UTF8_CHARSET,-1); } for (String name : params.keySet()) { List<String> valueList = params.getValues(name); String valueArr[] = new String[valueList.size()]; valueArr = valueList.toArray(valueArr); parameterMap.put(name,valueArr); } }
@Override public void setRequestURI(URI uri) { super.setRequestURI(uri); // parse parameter map Map<String, List<String>> pmap = new HashMap<>(); String query = uri.getQuery(); if (StringUtil.isNotBlank(query)) { MultiMap<String> params = new MultiMap<String>(); UrlEncoded.decodeTo(uri.getQuery(),params,StandardCharsets.UTF_8); for (String key : params.keySet()) { List<String> values = params.getValues(key); if (values == null) { pmap.put(key,new ArrayList<String>()); } else { // break link to original List<String> copy = new ArrayList<>(); copy.addAll(values); pmap.put(key,copy); } } super.setParameterMap(pmap); } }
if (StringUtil.isNotBlank(query))
if (StringUtil.isNotBlank(query))
if (StringUtil.isNotBlank(uri.getRawQuery()))
if (StringUtil.isNotBlank(cfgOutputDir)) if (StringUtil.isNotBlank(cfgPrefix))
List<String> requested = req.getSubProtocols(); String subprotocol = configurator.getNegotiatedSubprotocol(supported,requested); if (StringUtil.isNotBlank(subprotocol))
if (StringUtil.isNotBlank(responseHandshake))