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


Java DefaultGoPluginApiResponse.setResponseBody方法代码示例

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


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

示例1: toJson

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
protected GoPluginApiResponse toJson(Object data) throws JsonProcessingException {
	String json = data == null ? null : new ObjectMapper().writeValueAsString(data);
	DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(DefaultGoPluginApiResponse.SUCCESS_RESPONSE_CODE);
	response.setResponseBody(json);

	logger.debug("sending back json: " + json);

	return response;
}
 
开发者ID:cnenning,项目名称:go-artifactory-scm-plugin,代码行数:10,代码来源:AbstractArtifactoryPlugin.java

示例2: error

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
private GoPluginApiResponse error(String requestName, String requestBody, Exception e) {
	StringBuilder msg = new StringBuilder();
	msg.append("ERROR!");
	msg.append("\n\t");
	msg.append("request name: ");
	msg.append(requestName);
	msg.append("\n\t");
	msg.append("request body: ");
	msg.append(requestBody);
	logger.error(msg.toString(), e);
	String json = e.toString();
	DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(DefaultGoPluginApiResponse.INTERNAL_ERROR);
	response.setResponseBody(json);
	return response;
}
 
开发者ID:cnenning,项目名称:go-artifactory-scm-plugin,代码行数:16,代码来源:AbstractArtifactoryPlugin.java

示例3: execute

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse execute() throws Exception {
    JsonObject jsonObject = new JsonObject();
    jsonObject.addProperty("template", Util.readResource("/plugin-settings.template.html"));
    DefaultGoPluginApiResponse defaultGoPluginApiResponse = new DefaultGoPluginApiResponse(200);
    defaultGoPluginApiResponse.setResponseBody(GSON.toJson(jsonObject));
    return defaultGoPluginApiResponse;
}
 
开发者ID:gocd-contrib,项目名称:notification-skeleton-plugin,代码行数:9,代码来源:GetViewRequestExecutor.java

示例4: execute

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse execute() throws Exception {
    JsonObject jsonObject = new JsonObject();
    JsonArray notifications = new JsonArray();
    notifications.add(REQUEST_STAGE_STATUS.requestName());
    jsonObject.add("notifications", notifications);

    DefaultGoPluginApiResponse defaultGoPluginApiResponse = new DefaultGoPluginApiResponse(200);
    defaultGoPluginApiResponse.setResponseBody(GSON.toJson(jsonObject));
    return defaultGoPluginApiResponse;
}
 
开发者ID:gocd-contrib,项目名称:notification-skeleton-plugin,代码行数:12,代码来源:NotificationInterestedInExecutor.java

示例5: createErrorResponse

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
/**
 * Creates the error response.
 *
 * @param e the exception
 * @return the error response
 */
private GoPluginApiResponse createErrorResponse(Exception e) {
    final Map body = new HashMap();
    body.put("exception", e.getMessage());
    final DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(DefaultGoApiResponse.INTERNAL_ERROR);
    response.setResponseBody(parser.toJson(body));
    return response;
}
 
开发者ID:jmnarloch,项目名称:gocd-task-plugin-api,代码行数:14,代码来源:AbstractDispatchingTask.java

示例6: createResponse

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
private GoPluginApiResponse createResponse(int responseCode, Map body) {
    final DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(responseCode);
    response.setResponseBody(new GsonBuilder().serializeNulls().create().toJson(body));
    return response;
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:6,代码来源:CheckMkTask.java

示例7: createResponse

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
private GoPluginApiResponse createResponse(int responseCode, Object body) {
    final DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(responseCode);
    response.setResponseBody(new GsonBuilder().serializeNulls().create().toJson(body));
    return response;
}
 
开发者ID:indix,项目名称:gocd-s3-artifacts,代码行数:6,代码来源:S3PackageMaterialPoller.java

示例8: createResponse

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
private GoPluginApiResponse createResponse(int responseCode, Map body) throws IOException {
    final DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(responseCode);
    String bodyString = new JacksonFactory().toString(body);
    response.setResponseBody(bodyString);
    return response;
}
 
开发者ID:tsathishkumar,项目名称:gocd-git-release-tagger,代码行数:7,代码来源:ReleaseTaggerTask.java

示例9: createResponse

import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse; //导入方法依赖的package包/类
/**
 * Creates the response with the specific response code and content.
 *
 * @param responseCode the response code
 * @param body         the body content
 * @return the API response
 */
protected GoPluginApiResponse createResponse(int responseCode, Map body) {

    final DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(responseCode);
    response.setResponseBody(parser.toJson(body));
    return response;
}
 
开发者ID:jmnarloch,项目名称:gocd-task-plugin-api,代码行数:14,代码来源:BaseCommand.java


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