Search in sources :

Example 56 with JsonMappingException

use of org.codehaus.jackson.map.JsonMappingException in project coprhd-controller by CoprHD.

the class KHRequests method deleteRequestAsync.

/*
     * Send DELETE request to KittyHawk server in async mode
     * 
     * @param resource webResource
     * 
     * @param param parameters for delete
     * 
     * @return VNXeCommandJob
     * 
     * @throws VNXeException
     */
public VNXeCommandJob deleteRequestAsync(Object param) throws VNXeException {
    _logger.debug("delete data: " + _url);
    setAsyncMode();
    ClientResponse response = deleteRequest(param);
    VNXeCommandJob job;
    String resString = response.getEntity(String.class);
    ObjectMapper mapper = new ObjectMapper();
    try {
        job = mapper.readValue(resString, VNXeCommandJob.class);
    } catch (JsonParseException e) {
        _logger.error(String.format("unexpected data returned: %s from: %s ", resString, _url), e);
        throw VNXeException.exceptions.unexpectedDataError(String.format("unexpected data returned: %s", resString), e);
    } catch (JsonMappingException e) {
        _logger.error(String.format("unexpected data returned: %s from: %s ", resString, _url), e);
        throw VNXeException.exceptions.unexpectedDataError(String.format("unexpected data returned: %s", resString), e);
    } catch (IOException e) {
        _logger.error(String.format("unexpected data returned: %s from: %s ", resString, _url), e);
        throw VNXeException.exceptions.unexpectedDataError(String.format("unexpected data returned: %s", resString), e);
    }
    if (job != null) {
        _logger.info("submitted the deleting file system job: {} ", job.getId());
    }
    return job;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Example 57 with JsonMappingException

use of org.codehaus.jackson.map.JsonMappingException 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";
}
Also used : UserCertPojo(com.itrus.portal.utils.UserCertPojo) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) Enterprise(com.itrus.portal.db.Enterprise) ArrayList(java.util.ArrayList) CertBuf(com.itrus.portal.db.CertBuf) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 58 with JsonMappingException

use of org.codehaus.jackson.map.JsonMappingException 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";
}
Also used : ProductExample(com.itrus.portal.db.ProductExample) Product(com.itrus.portal.db.Product) IOException(java.io.IOException) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 59 with JsonMappingException

use of org.codehaus.jackson.map.JsonMappingException 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";
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) Enterprise(com.itrus.portal.db.Enterprise) Bill(com.itrus.portal.db.Bill) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) HashMap(java.util.HashMap) Map(java.util.Map) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 60 with JsonMappingException

use of org.codehaus.jackson.map.JsonMappingException in project portal by ixinportal.

the class HomeController 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();
    uiModel.addAttribute("projectId", product.getProject());
    uiModel.addAttribute("productId", product.getId());
    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) {
            // 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/denglu2";
    }
    if (null != product.getIsBan() && product.getIsBan() == true) {
        EnterpriseQqExample enterprise = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterprise.createCriteria();
        qqEx.andProjectIdEqualTo(product.getProject());
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise);
        uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
        // 产品已经下架
        return "ixinweb/chanpinxiajia";
    }
    return "ixinweb/zhuce";
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) ProductExample(com.itrus.portal.db.ProductExample) Product(com.itrus.portal.db.Product) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException)

Aggregations

JsonMappingException (org.codehaus.jackson.map.JsonMappingException)88 IOException (java.io.IOException)79 JsonParseException (org.codehaus.jackson.JsonParseException)53 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)36 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)27 ArrayList (java.util.ArrayList)24 HashMap (java.util.HashMap)19 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)15 Response (javax.ws.rs.core.Response)13 Map (java.util.Map)11 List (java.util.List)10 GET (javax.ws.rs.GET)10 Path (javax.ws.rs.Path)10 Produces (javax.ws.rs.Produces)10 WebApplicationException (javax.ws.rs.WebApplicationException)10 TypeReference (org.codehaus.jackson.type.TypeReference)10 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)7 ClientResponse (com.sun.jersey.api.client.ClientResponse)6 StringWriter (java.io.StringWriter)5 Enterprise (com.itrus.portal.db.Enterprise)4