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


Java JsonNodeFactory.objectNode方法代码示例

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


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

示例1: createAuthLinkResponse

import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public static String createAuthLinkResponse(){

        JsonNodeFactory f = JsonNodeFactory.instance ;
        ObjectNode loginResponse = f.objectNode();
        loginResponse.put("text","Authorization for SkyGiraffe to use Slack details is required.");
        ArrayNode attachments = loginResponse.putArray("attachments");
        ObjectNode att = f.objectNode();
        att.put("fallback", "Please authorize SkyGiraffe to access to your Slack details ...");
        att.put("pretext", "");
        att.put("title", "Please authorize..");
        att.put("title_link", Config.getPropertyValue("SLACK_AUTH_URL_DEV"));
        att.put("text","Once authorized and logged into SkyGiraffe try '/sg help' to see all commands");
        att.put("color", "#7CD197");

        attachments.add(att);
        return loginResponse.toString();

    }
 
开发者ID:skygiraffe,项目名称:skygiraffe-slackbot,代码行数:19,代码来源:JsonUtil.java

示例2: createLoginLinkResponse

import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
 * {
 "attachments": [
 {
 "fallback": "Please login into SkyGiraffe to continue ...",
 "pretext": "SkyGiraffe Login",
 "title": "Please login into SkyGiraffe to continue ...",
 "title_link": "https://sgbot-mobilityai.rhcloud.com/SGbot-1.0/skyg/login?key=",
 "text": "Once logged in try '/sg help' to see all commands",
 "color": "#7CD197"
 }
 ]
 }
 * @return
 */
public static String createLoginLinkResponse(String slackUserId, String email, String teamId){

    JsonNodeFactory f = JsonNodeFactory.instance ;
    ObjectNode loginResponse = f.objectNode();
    loginResponse.put("text","Login to SkyGiraffe is required.");
    ArrayNode attachments = loginResponse.putArray("attachments");
    ObjectNode att = f.objectNode();
    att.put("fallback", "Please login into SkyGiraffe to continue ...");
    att.put("pretext", "");
    att.put("title", "Please login..");
    att.put("title_link", Config.getPropertyValue("SGDS_LOGIN_URL_DEV")+slackUserId+"&EMAIL="+email+"&TEAMID="+teamId);
    att.put("text","Once logged in try '/sg help' to see all commands");
    att.put("color", "#7CD197");

    attachments.add(att);

    return loginResponse.toString();

}
 
开发者ID:skygiraffe,项目名称:skygiraffe-slackbot,代码行数:35,代码来源:JsonUtil.java

示例3: getParameterList

import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public static String getParameterList(String sessionId, String appId, String repId, String repUpId) throws IOException {

        //
        if (sessionId == null || sessionId.isEmpty())
            throw new IllegalArgumentException("Session Id is empty. Please login.");

        HttpPost postRequest = new HttpPost("https://wspublisherv2https.skygiraffe.com/WSPublisherV2.svc/GetReport_ParametersMainScreen4");

        // add header
        postRequest.setHeader("Content-Type", "application/json");

        JsonNodeFactory f = JsonNodeFactory.instance;

        ObjectNode o = f.objectNode();

        o.put("ApplicationID", appId);
        o.put("ReportID", repId);
        o.put("TabID","");

        ArrayNode diuId = f.arrayNode();
        diuId = o.putArray("DataItemUpdateIDs");
        o.put("ReportUpdateID",repUpId);
        o.put("RequestID",sessionId);

        o.put("SessionID",sessionId);

        StringEntity inputApps = new StringEntity(o.toString());

        inputApps.setContentType("application/json");
        postRequest.setEntity(inputApps);

        CloseableHttpResponse responseParams = getHttpClient().execute(postRequest);
        String paramStr = "";
        try {
            HttpEntity entityApps = responseParams.getEntity();
            paramStr = EntityUtils.toString(entityApps, "UTF-8");
            EntityUtils.consume(entityApps);
        }finally{
            responseParams.close();
        }
        logger.debug("Params = "+paramStr);
        return paramStr;
    }
 
开发者ID:skygiraffe,项目名称:skygiraffe-slackbot,代码行数:44,代码来源:SGDSClient.java


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