当前位置: 首页>>代码示例>>Java>>正文


Java Resty.json方法代码示例

本文整理汇总了Java中us.monoid.web.Resty.json方法的典型用法代码示例。如果您正苦于以下问题:Java Resty.json方法的具体用法?Java Resty.json怎么用?Java Resty.json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在us.monoid.web.Resty的用法示例。


在下文中一共展示了Resty.json方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJSON

import us.monoid.web.Resty; //导入方法依赖的package包/类
/**
	 * @param url
	 * @return Returns the JSON 
	 */
	private String getJSON(String url){
		JSONResource res = null;
		JSONObject obj = null;
		Resty resty = new Resty();
		
		try {
			res = resty.json(url);
			obj = res.toObject();
			
		} catch (IOException | JSONException e) {
			// TODO: not my favorite way but does the trick
//			e.printStackTrace();
			return getJSON(url);
		}
		
		return obj.toString();
	}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:22,代码来源:AnalysisDrilldown.java

示例2: getJSON

import us.monoid.web.Resty; //导入方法依赖的package包/类
/**
 * @param url
 * @return Returns the JSON as JSON Resource
 */
private JSONResource getJSON(String url) throws uQasarException{
	JSONResource res = null;
	Resty resty = new Resty();

	// Connection counter +1
	counter +=1;

	// Replaces spaces in URL with char %20
	url = url.replaceAll(" ", "%20");

	try {
		res = resty.json(url);

	} catch (IOException e) {

		// Check if the limit of trials has been reached
		if(counter<counterLimit){
			return getJSON(url);} else
				throw new uQasarException("Cubes Server is not availabe at this moument, error to connect with " +url);
	}

	// Reset the connection counter to 0
	counter = 0;

	return res;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:31,代码来源:CubesDataService.java

示例3: login

import us.monoid.web.Resty; //导入方法依赖的package包/类
public void login() throws IOException, LoginException {
    Resty r = new Resty();
    JSONResource authTickets = r.json(baseURL + "access/ticket",
            form("username=" + username + "@" + realm + "&password=" + password));
    try {
        authTicket = authTickets.get("data.ticket").toString();
        csrfPreventionToken = authTickets.get("data.CSRFPreventionToken").toString();
        authTicketIssuedTimestamp = new Date();
    } catch (Exception e) {
        throw new LoginException("Failed reading JSON response");
    }
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:13,代码来源:Connector.java

示例4: rollbackQemuMachineSnapshot

import us.monoid.web.Resty; //导入方法依赖的package包/类
public String rollbackQemuMachineSnapshot(String node, Integer vmid, String snapshotName)
        throws IOException, LoginException, JSONException {
    Resty r = authedClient();
    String resource = "nodes/" + node + "/qemu/" + vmid.toString() + "/snapshot/" + snapshotName + "/rollback";
    JSONResource response = r.json(baseURL + resource, form(""));
    return response.toObject().getString("data");
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:8,代码来源:Connector.java

示例5: startQemuMachine

import us.monoid.web.Resty; //导入方法依赖的package包/类
public String startQemuMachine(String node, Integer vmid) throws IOException, LoginException, JSONException {
    Resty r = authedClient();
    String resource = "nodes/" + node + "/qemu/" + vmid.toString() + "/status/start";
    JSONResource response = r.json(baseURL + resource, form(""));
    return response.toObject().getString("data");
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:7,代码来源:Connector.java

示例6: stopQemuMachine

import us.monoid.web.Resty; //导入方法依赖的package包/类
public String stopQemuMachine(String node, Integer vmid) throws IOException, LoginException, JSONException {
    Resty r = authedClient();
    String resource = "nodes/" + node + "/qemu/" + vmid.toString() + "/status/stop";
    JSONResource response = r.json(baseURL + resource, form(""));
    return response.toObject().getString("data");
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:7,代码来源:Connector.java


注:本文中的us.monoid.web.Resty.json方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。