作者:Manticore-v | 来源:互联网 | 2023-09-25 10:33
本文整理了Java中com.jeesuite.common.json.JsonUtils.getMapper()
方法的一些代码示例,展示了JsonUtils.getMapper()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonUtils.getMapper()
方法的具体详情如下:
包路径:com.jeesuite.common.json.JsonUtils
类名称:JsonUtils
方法名:getMapper
JsonUtils.getMapper介绍
暂无
代码示例
代码示例来源:origin: vakinge/jeesuite-libs
/**
* 转换成格式化的json字符串
* @param object
* @return
*/
public static String toPrettyJson(Object object){
try {
return getMapper().writerWithDefaultPrettyPrinter().writeValueAsString(object);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: vakinge/jeesuite-passport
public static LoginUserInfo unsign(String jwt) {
final JWTVerifier verifier = new JWTVerifier(SECRET);
try {
final Map claims= verifier.verify(jwt);
if (claims.containsKey(PAYLOAD)&&claims.containsKey(USERID)) {
String json = (String)claims.get(PAYLOAD);
String userId = claims.get(USERID).toString();
LoginUserInfo user = JsonUtils.getMapper().readValue(json,LoginUserInfo.class);
if (userId.equals(user.getId().toString())){
return user;
}
}
return null;
} catch (Exception e) {
return null;
}
}
代码示例来源:origin: vakinge/oneplatform
@Override
public void run() {
while (true) {
if(System.currentTimeMillis() - startTime > VERIFY_WAIT_MILLIS){
log.warn(" >>>> service registration status not verify,please check it!!!!");
return;
}
try {
List serverInfos = eurekaClient.getInstancesByVipAddress(vipAddress, false);
for (InstanceInfo nextServerInfo : serverInfos) {
if(nextServerInfo.getIPAddr().equals(IpUtils.LOCAL_BACK_IP) ||
nextServerInfo.getIPAddr().equals(IpUtils.getLocalIpAddr())){
String instanceInfoJson = JsonUtils.getMapper().writerWithDefaultPrettyPrinter().writeValueAsString(nextServerInfo);
log.info("verifying service registration with eureka finished,instance:\n{}",instanceInfoJson);
return;
}
}
} catch (Throwable e) {}
try {Thread.sleep(5000);} catch (Exception e1) {}
log.info("Waiting 5s... verifying service registration with eureka ...");
}
}
}).start();