本文整理汇总了Java中org.apache.commons.lang.StringUtils.deleteWhitespace方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.deleteWhitespace方法的具体用法?Java StringUtils.deleteWhitespace怎么用?Java StringUtils.deleteWhitespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.StringUtils
的用法示例。
在下文中一共展示了StringUtils.deleteWhitespace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlaceholderRequest
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public String onPlaceholderRequest(Player p, String identifier) {
if(identifier.equals("current_tag")){
String storageTag = StorageHandler.getPlayerTag(p);
String tag = storageTag != null ? storageTag : "";
DogTag dt = DogTags.getTag(tag);
if(dt == null){
return StringUtils.deleteWhitespace("");
}else return dt.getPrefix();
}
return null;
}
示例2: doWatch
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public void doWatch(String configCenter)
throws URISyntaxException, UnsupportedEncodingException, InterruptedException {
CountDownLatch waiter = new CountDownLatch(1);
IpPort ipPort = NetUtils.parseIpPortFromURI(configCenter);
String url = URIConst.REFRESH_ITEMS + "?dimensionsInfo="
+ StringUtils.deleteWhitespace(URLEncoder.encode(serviceName, "UTF-8"));
Map<String, String> headers = new HashMap<>();
headers.put("x-domain-name", tenantName);
if (ConfigCenterConfig.INSTANCE.getToken() != null) {
headers.put("X-Auth-Token", ConfigCenterConfig.INSTANCE.getToken());
}
HttpClientWithContext vertxHttpClient = clientMgr.findThreadBindClientPool();
vertxHttpClient.runOnContext(client -> {
Map<String, String> authHeaders = new HashMap<>();
authHeaderProviders.forEach(provider -> authHeaders.putAll(provider.getSignAuthHeaders(
createSignRequest(null, configCenter + url, headers, null))));
client.websocket(refreshPort, ipPort.getHostOrIp(), url,
new CaseInsensitiveHeaders().addAll(headers)
.addAll(authHeaders),
ws -> {
ws.exceptionHandler(e -> {
LOGGER.error("watch config read fail", e);
stopHeartBeatThread();
isWatching = false;
});
ws.closeHandler(v -> {
LOGGER.warn("watching config connection is closed accidentally");
stopHeartBeatThread();
isWatching = false;
});
ws.handler(action -> {
LOGGER.info("watching config recieved {}", action);
Map<String, Object> mAction = action.toJsonObject().getMap();
if ("CREATE".equals(mAction.get("action"))) {
refreshConfig(configCenter);
} else if ("MEMBER_CHANGE".equals(mAction.get("action"))) {
refreshMembers(memberdis);
} else {
parseConfigUtils.refreshConfigItemsIncremental(mAction);
}
});
startHeartBeatThread(ws);
isWatching = true;
waiter.countDown();
},
e -> {
LOGGER.error("watcher connect to config center {} failed: {}", serverUri, e.getMessage());
waiter.countDown();
});
});
waiter.await();
}