use of org.codehaus.jackson.JsonGenerationException in project spring-data-document-examples by spring-projects.
the class CouchDbMappingJacksonHttpMessageConverter method writeInternal.
@Override
protected void writeInternal(Object o, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException {
JsonEncoding encoding = getEncoding(outputMessage.getHeaders().getContentType());
JsonGenerator jsonGenerator = this.objectMapper.getJsonFactory().createJsonGenerator(outputMessage.getBody(), encoding);
try {
if (this.prefixJson) {
jsonGenerator.writeRaw("{} && ");
}
this.objectMapper.writeValue(jsonGenerator, o);
} catch (JsonGenerationException ex) {
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
}
}
use of org.codehaus.jackson.JsonGenerationException in project spring-data-document-examples by spring-projects.
the class CouchDbMappingJacksonHttpMessageConverter method writeInternal.
@Override
protected void writeInternal(Object o, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException {
JsonEncoding encoding = getEncoding(outputMessage.getHeaders().getContentType());
JsonGenerator jsonGenerator = this.objectMapper.getJsonFactory().createJsonGenerator(outputMessage.getBody(), encoding);
try {
if (this.prefixJson) {
jsonGenerator.writeRaw("{} && ");
}
this.objectMapper.writeValue(jsonGenerator, o);
} catch (JsonGenerationException ex) {
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
}
}
use of org.codehaus.jackson.JsonGenerationException in project portal by ixinportal.
the class BindCertWebController method bindPage.
@RequestMapping("/bindCertPage")
public String bindPage(@RequestParam(value = "certSn", required = true) String certSn, HttpSession session, Model uiModel) throws UserInfoServiceException {
// 是否登录
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == webuserInfo || null == webenterprise) {
// 登录状态失效,跳转到注册页面
return "redirect:/userInfoWeb/denglu.html";
}
// 返回所有信任源所有
List<String> allIssUerDn = new ArrayList<String>();
allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
try {
uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
} catch (JsonGenerationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
UserCert userCert = null;
userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert)
throw new UserInfoServiceException("未找到对应的证书信息");
// DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
UserCertPojo ucp = new UserCertPojo(userCert, userCert.getCertStartTime().getTime() + "", userCert.getCertEndTime().getTime() + "");
CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectByPrimaryKey", userCert.getCertBuf());
uiModel.addAttribute("userCert", ucp);
uiModel.addAttribute("certBase64", certBuf.getCertBuf().replaceAll("\n", ""));
return "ixinweb/bangding";
}
use of org.codehaus.jackson.JsonGenerationException in project portal by ixinportal.
the class RegisterController method register.
@RequestMapping(value = "/s/{name}")
public String register(@PathVariable("name") String name, @RequestParam(value = "login", required = false) String login, HttpSession session, Model uiModel) {
ProductExample productExample = new ProductExample();
ProductExample.Criteria pe = productExample.createCriteria();
pe.andProNameEqualTo(name);
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByExample", productExample);
// return
// "forward:/userInfoWeb/zhuce.html?projectId="+product.getProject()+"&productId="+product.getId();
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", product.getProject());
uiModel.addAttribute("projectId", product.getProject());
uiModel.addAttribute("productId", product.getId());
uiModel.addAttribute("productName", product.getName());
uiModel.addAttribute("projectName", project.getName());
if (StringUtils.isNotBlank(login) && login.equals("1")) {
List<String> allIssUerDn = new ArrayList<String>();
allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
try {
uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
// 返回随机数
String random = UniqueIDUtils.genUUID();
uiModel.addAttribute("random", random);
session.setAttribute("webrandom", random);
} catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return "ixinweb/denglu2";
}
if (null != product.getIsBan() && product.getIsBan() == true) {
EnterpriseQqExample enterprise1 = new EnterpriseQqExample();
EnterpriseQqExample.Criteria qqEx = enterprise1.createCriteria();
qqEx.andProjectIdEqualTo(product.getProject());
EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise1);
if (enterpriseqq != null && enterpriseqq.getEnterpriseQq() != null) {
uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
}
// 产品已经下架
return "ixinweb/chanpinxiajia";
}
return "ixinweb/zhuce";
}
use of org.codehaus.jackson.JsonGenerationException in project portal by ixinportal.
the class SecurityServiceWebController method securityCenter.
// 选出当前用户当前企业的所有证书和证书所绑定的用户信息
@RequestMapping("/securityCenter")
public String securityCenter(HttpSession session, Model uiModel) {
UserInfo userInfos = (UserInfo) session.getAttribute("webuserInfo");
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == userInfos || null == enterprise) {
// 登录状态失效,跳转到注册页面
return "redirect:/userInfoWeb/denglu.html";
}
Map param = new HashMap();
param.put("userinfoid", userInfos.getId());
param.put("enterpriseid", enterprise.getId());
List<Map<String, Object>> userCertList = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByUserInfoAndEnterprise", param);
if (null != userCertList && !userCertList.isEmpty()) {
for (int i = 0; i < userCertList.size(); i++) {
if (null != userCertList.get(i).get("bill_status") && (userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_8) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_7) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_6)) && userCertList.get(i).containsKey("renewBillId")) {
// 状态为已完成的订单并且订单包含旧证书id
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", userCertList.get(i).get("renewBillId"));
if (null != bill.getOldUserCert()) {
UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", bill.getOldUserCert());
userCertList.get(i).put("oldCertSn", oldUserCert.getCertSn());
}
}
}
}
try {
String usercertsString = jsonTool.writeValueAsString(userCertList);
uiModel.addAttribute("usercerts", usercertsString);
List<String> allIssUerDn = new ArrayList<String>();
allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
} catch (JsonGenerationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "ixinweb/anquanfuwu";
}
Aggregations