本文整理匯總了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();
}