當前位置: 首頁>>代碼示例>>Java>>正文


Java JSONObject類代碼示例

本文整理匯總了Java中net.minidev.json.JSONObject的典型用法代碼示例。如果您正苦於以下問題:Java JSONObject類的具體用法?Java JSONObject怎麽用?Java JSONObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JSONObject類屬於net.minidev.json包,在下文中一共展示了JSONObject類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handlePost

import net.minidev.json.JSONObject; //導入依賴的package包/類
public void handlePost(HttpServletRequest request, HttpServletResponse response, ITicket credentials, JSONObject jsonObject) throws ServletException, IOException {
JSONObject returnMessage = newJSONObject();
JSONObject cargo = (JSONObject)jsonObject.get(ICredentialsMicroformat.CARGO);
String message = "", rtoken="";
String verb = getVerb(jsonObject);
int code = 0;
IResult r;
System.out.println("CondoHandler.handlePost "+verb);
if (verb.equals(ITopicMapMicroformat.PUT_TOPIC)) {
	//
} else {
	String x = IErrorMessages.BAD_VERB+"-AdminServletPost-"+verb;
	environment.logError(x, null);
	throw new ServletException(x);
}
returnMessage.put(ICredentialsMicroformat.RESP_TOKEN, rtoken);
returnMessage.put(ICredentialsMicroformat.RESP_MESSAGE, message);
super.sendJSON(returnMessage.toJSONString(), code, response);
returnMessage = null;	}
 
開發者ID:topicquests,項目名稱:backside-servlet-ks,代碼行數:20,代碼來源:CondoHandler.java

示例2: prepareBugDescriptionForBugCreation

import net.minidev.json.JSONObject; //導入依賴的package包/類
/**
 * Prepares the description of bug body. By adding build url, a nice header, a note and
 * excaptes html tags, json tags.
 *
 * @param description
 * @return
 */
private String prepareBugDescriptionForBugCreation(String description)
{
    description = "*[Automation failed tests]*\n" +
            "||Testcase failing|| Parameters||\n" +
            description + "\n" +
            System.getProperty(AUTO_CREATE_ADDITIONAL_DETAILS,
                    configuration.getProperty(AUTO_CREATE_ADDITIONAL_DETAILS, "")) + "\n" +
            "Build url: " + buildUrl;
    description = description + "\n\n\n" + "Note: This bug is created automatically by DolphinNG." +
            " Please do not edit summary line of the bug.";
    description = StringEscapeUtils.escapeHtml3(description);
    description = StringEscapeUtils.escapeHtml4(description);
    description = JSONObject.escape(description);
    return description;
}
 
開發者ID:basavaraj1985,項目名稱:DolphinNG,代碼行數:23,代碼來源:JIRAClient.java

示例3: auditNo

import net.minidev.json.JSONObject; //導入依賴的package包/類
@RequestMapping(value = "/off-audit.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String auditNo(@RequestParam Integer[] ids) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);

    if (ids == null || ids.length < 1) {
        server.put("msg", "Don't do that!The ids is empty!!!");
        return output.toJSONString(jsonStyle);
    }
    try {
        appService.updateNoAudit(Arrays.asList(ids));
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } catch (Exception e) {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", "係統錯誤");
    }
    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:22,代碼來源:AppController.java

示例4: delRolling

import net.minidev.json.JSONObject; //導入依賴的package包/類
@RequestMapping(value = "/rolling/del.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String delRolling(@RequestParam Integer[] id) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        int rows = rollinfoService.deleteByAppIds(Arrays.asList(id));
        boolean del = rows == id.length;
        if (del) {
            server.put("code", SvrResult.OK.getCode());
            server.put("msg", SvrResult.OK.getMsg());
        } else {
            server.put("code", SvrResult.PART_DATA.getCode());
            server.put("msg", SvrResult.PART_DATA.getMsg());
        }
    } catch (Exception e) {
        logger.error("Exception", e);
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", SvrResult.ERROR.getMsg());
    }
    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:24,代碼來源:AppController.java

示例5: getInstallPackByType

import net.minidev.json.JSONObject; //導入依賴的package包/類
/**
 * 根據marketAppId,cputype(cpu類型),phoneId查詢對應的安裝包
 * 
 * @param marketAppId
 * @param phoneId
 * @param cputype
 * @return
 */
@RequestMapping(value = { "/install-pack.json", "/cdn/install-pack.json" }, method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String getInstallPackByType(@RequestParam int marketAppId, @RequestParam int phoneId,
        @RequestParam int cputype) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        List<BigGamePack> bigGamePack = bigGamePackService.findBigGamePackByParams(marketAppId, phoneId, cputype);
        output.put("data", bigGamePack);
        server.put("code", OK.getCode());
        server.put("msg", OK.getMsg());
    } catch (Exception e) {
        server.put("code", ERROR.getCode());
        server.put("msg", ERROR.getMsg());
        logger.error("Exception", e);
    }

    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:29,代碼來源:AppController.java

示例6: delete

import net.minidev.json.JSONObject; //導入依賴的package包/類
@RequestMapping(value = "/del.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String delete(@RequestParam("id") int id) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        boolean result = service.deleteByIds(Arrays.asList(id));
        if (result) {
            server.put("code", SvrResult.OK.getCode());
            server.put("msg", SvrResult.OK.getMsg());
        } else {
            server.put("code", SvrResult.ERROR.getCode());
            server.put("msg", SvrResult.ERROR.getMsg());
        }
    } catch (Exception e) {
        server.put("code", -1.);
        server.put("msg", e.getMessage());
        logger.error("Exception:", e);
    }
    return output.toJSONString();
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:23,代碼來源:UserController.java

示例7: powerTuiJianChannel

import net.minidev.json.JSONObject; //導入依賴的package包/類
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = "/powerchannel/tuijian/{typeId}/{start}/{count}.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String powerTuiJianChannel(@PathVariable int typeId, @PathVariable int start, @PathVariable int count) {
    JSONObject res = new JSONObject();
    JSONObject server = new JSONObject();
    List<App> list = appsService.getPowerChannelTuiJian(typeId, start, count);
    if (list == null || list.isEmpty()) {
        server.put("code", SvrResult.NO_DATA.getCode());
        server.put("msg", SvrResult.NO_DATA.getMsg());
    } else {
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
        // for server developers debugger.
        server.put("len", list.size());
    }
    res.put("data", list);
    res.put("result", server);
    return res.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:21,代碼來源:AppsController.java

示例8: appToManyIntallPackages

import net.minidev.json.JSONObject; //導入依賴的package包/類
/**
 * 一個App對應多個安裝包
 * 
 * @return
 */
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = "/cdn/big-game.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String appToManyIntallPackages(@RequestParam(required = true) short catalog,
        @RequestParam(required = false) Integer subCatalog) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        List<AppAndBigGamesVo> list = appService.getAppListByCatalog(catalog, subCatalog);
        output.put("data", list);
        server.put("code", OK.getCode());
        server.put("msg", OK.getMsg());
    } catch (Exception e) {
        server.put("code", ERROR.getCode());
        server.put("msg", ERROR.getMsg());
        logger.error("Exception", e);
    }
    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:26,代碼來源:AppController.java

示例9: appByApk

import net.minidev.json.JSONObject; //導入依賴的package包/類
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = "/cdn/apk/{pkname}/{signaturesha1}.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String appByApk(@PathVariable String pkname, @PathVariable String signaturesha1) {
    ScanApp app = appService.getAppByApk(pkname, signaturesha1);
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);

    if (app != null) {
        output.put("signature", true);
        output.put("data", app);
    } else {
        output.put("signature", false);
        ScanApp appByPkname = appService.getAppByPkame(pkname);
        output.put("data", appByPkname);
    }

    server.put("code", SvrResult.OK.getCode());
    server.put("msg", SvrResult.OK.getMsg());
    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:23,代碼來源:UpgradeAppController.java

示例10: biggameByBrand

import net.minidev.json.JSONObject; //導入依賴的package包/類
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = "/cdn/phone-info.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String biggameByBrand(@RequestParam String brand) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        List<PhoneVo> phoneList = phoneInfoService.findPhoneInfoList(brand);
        output.put("data", phoneList);
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } catch (Exception e) {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", SvrResult.ERROR.getMsg());
    }

    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:20,代碼來源:PhoneBaseInfoController.java

示例11: getMoTag

import net.minidev.json.JSONObject; //導入依賴的package包/類
@RequestMapping(value = "/get.{id}.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String getMoTag(@PathVariable int id) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    try {
        MoTag moTag = service.get(id);
        if (moTag != null) {
            output.put("data", moTag);
        } else {
            output.put("data", null);
        }
    } catch (UnsupportedOperationException e) {
        output.put("data", null);
    }
    return output.toJSONString();
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:18,代碼來源:MoTagController.java

示例12: editCatalog

import net.minidev.json.JSONObject; //導入依賴的package包/類
@RequestMapping(value = "/edit-catalog.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String editCatalog(@RequestParam short catalog, @RequestParam int subCatalog, @RequestParam Integer[] ids) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    if (ids == null || ids.length < 1) {
        server.put("msg", "Don't do that!The ids is empty!!!");
        return output.toJSONString(jsonStyle);
    }
    boolean edit = appService.updateBatchCatalog(Arrays.asList(ids), catalog, subCatalog);

    if (edit) {
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } else {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", "數目不對");
    }
    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:22,代碼來源:AppController.java

示例13: powerTuiJian

import net.minidev.json.JSONObject; //導入依賴的package包/類
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = "/power/tuijian/{typeId}/{start}/{count}.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String powerTuiJian(@PathVariable int typeId, @PathVariable int start, @PathVariable int count) {
    JSONObject res = new JSONObject();
    JSONObject server = new JSONObject();
    List<App> list = appsService.getPowerTuiJian(typeId, start, count);
    if (list == null || list.isEmpty()) {
        server.put("code", SvrResult.NO_DATA.getCode());
        server.put("msg", SvrResult.NO_DATA.getMsg());
    } else {
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
        // for server developers debugger.
        server.put("len", list.size());
    }
    res.put("data", list);
    res.put("result", server);
    return res.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:21,代碼來源:AppsController.java

示例14: editCatalog

import net.minidev.json.JSONObject; //導入依賴的package包/類
@RequestMapping(value = "/edit-catalog.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String editCatalog(@RequestParam short catalog, @RequestParam int subCatalog, @RequestParam Integer[] ids,
        @RequestParam String subCatalogName) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    if (ids == null || ids.length < 1) {
        server.put("msg", "Don't do that!The ids is empty!!!");
        return output.toJSONString(jsonStyle);
    }
    boolean edit = marketAppService.editCatalog(Arrays.asList(ids), catalog, subCatalog, subCatalogName);
    if (edit) {
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } else {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", "數目不對");
    }
    return output.toJSONString(jsonStyle);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:22,代碼來源:MarketAppController.java

示例15: reset

import net.minidev.json.JSONObject; //導入依賴的package包/類
@RequestMapping(value = "/reset.d", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String reset(HttpServletRequest request) {
    long start = System.currentTimeMillis();
    logger.info("Accept the quest to reset index!");
    searchService.reset();

    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    output.put("cost", (System.currentTimeMillis() - start) / 1000 + " s!");

    server.put("code", SvrResult.OK.getCode());
    server.put("msg", SvrResult.OK.getMsg());
    return output.toJSONString();
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:17,代碼來源:DataAdminController.java


注:本文中的net.minidev.json.JSONObject類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。