我是个大摇大摆的新手。我有以下代码:
@RestController
@RequestMapping(value = { V1P})
@Api(value = V1P, description= "My Operations Management API")
public class MethodController {
/**
* @return -
*/
@ApiOperation(value = "retrieve task information", notes = "retrieve service instance information", response = String.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Failure")})
@SuppressWarnings("nls")
@RequestMapping(value = BASE_PATH , method = RequestMethod.GET, consumes = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> retrieve() {
....
}
@ApiOperation(nickname = "openTaskUsingGet", value = "Open a task", notes = "API to Open a task", response = String.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Failure")})
@ApiImplicitParams({
@ApiImplicitParam(name = "taskReferenceId", value = "Reference ID of the task", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "taskSummary", value = "The task's summary description", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "contentDocumentId", value = "The content document ID of the task", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "createdBy", value = "The name of the creating user", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "teamReferenceId", value = "The creating team reference ID", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "taskFromTime", value = "Task planned start time", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "taskDueTime", value = "Task planned due time", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "taskGroup", value = "Task group name", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "taskType", value = "Task type", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteLongitude", value = "Site longitude coordinate", required = true, dataType = "double", paramType = "query"),
@ApiImplicitParam(name = "siteLatitude", value = "Site latitude coordinate", required = true, dataType = "double", paramType = "query"),
@ApiImplicitParam(name = "siteZipCode", value = "Site zip code", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteName", value = "Site name", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteCountry", value = "Site country", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteState", value = "Site state", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteCity", value = "Site city", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteAddress", value = "Site address", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteComments", value = "Site comments", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "siteReferenceId", value = "Site reference ID", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "eqType", value = "Equipment type", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "eqReferenceId", value = "Equipment reference ID", required = true, dataType = "string", paramType = "query")
})
@SuppressWarnings({ "nls", "javadoc" })
@RequestMapping(value = BASE_PATH + "/mob/openTask" , method = RequestMethod.GET, consumes = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> openTask(
@RequestParam("taskReferenceId") String taskReferenceId,
@RequestParam("taskSummary") String taskSummary,
@RequestParam("contentDocumentId") String contentDocumentId,
@RequestParam("createdBy") String createdBy,
@RequestParam("teamReferenceId") String teamReferenceId,
@RequestParam("taskFromTime") String taskFromTime,
@RequestParam("taskDueTime") String taskDueTime,
@RequestParam("taskGroup") String taskGroup,
@RequestParam("taskType") String taskType,
@RequestParam("siteLongitude") double siteLongitude,
@RequestParam("siteLatitude") double siteLatitude,
@RequestParam("siteZipCode") String siteZipCode,
@RequestParam("siteName") String siteName,
@RequestParam("siteCountry") String siteCountry,
@RequestParam("siteState") String siteState,
@RequestParam("siteCity") String siteCity,
@RequestParam("siteAddress") String siteAddress,
@RequestParam("siteComments") String siteComments,
@RequestParam("siteReferenceId") String siteReferenceId,
@RequestParam("eqType") String eqType,
@RequestParam("eqReferenceId") String eqReferenceId){
....
}
@ApiOperation(nickname = "openTaskUsingPOST", value = "Open a task", notes = "API to Open a task", response = String.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Failure")})
@SuppressWarnings({ "nls", "javadoc" })
@RequestMapping(value = BASE_PATH + "/mob/openTask" , method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> openTask(@RequestBody OpenTaskCmd cmd){
...
}
@ApiOperation(value = "Get an HTML summary of a package content", notes = "API to get an HTML summary of a package content", response = String.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Failure")})
@ApiImplicitParams({
@ApiImplicitParam(name = "packageName", value = "The name of the required package", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "packageVersion", value = "The required package version", required = true, dataType = "string", paramType = "query")
})
@SuppressWarnings({ "nls", "javadoc" })
@RequestMapping(value = BASE_PATH + "/mob/getContent" , method = RequestMethod.GET, consumes = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.TEXT_HTML_VALUE)
public ResponseEntity<String> getContent(@RequestParam("packageName") String pkgName,
@RequestParam("packageVersion") String pkgVersion){
....
}
@ApiOperation(value = "Get the activities of a project as a Json array", notes = "API to get the activities of a project as a Json array")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Failure")})
@ApiImplicitParams({
@ApiImplicitParam(name = "startIndex", value = "The first activity index", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "The number of activities", required = true, dataType = "string", paramType = "query")
})
@SuppressWarnings("javadoc")
@RequestMapping(value = BASE_PATH + "/mob/readActivities" , method = RequestMethod.GET, consumes = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> readActivities(@RequestParam("startIndex") int startIndex,
@RequestParam("pageSize") int pageSize){
...
}
}
这是我得到的json的一部分:
{"swagger":"2.0","info":{"description":"Operation Management","version":"v1","title":"API","host":"127.0.0.1","basePath":"/","tags":[{"name":"v1","description":"Operations Management API"}],
"paths":{
"/v1/proxy/resource":{..."responses":{"200":{"description":"Success","schema":{"type":"string"}},"401":{"description":"Unauthorized"},"500":{"description":"Failure","schema":{"$ref":"#/definitions/Error"}}}}},
"/v1/proxy/resource/mob/getContent":{"get":{...,"responses":{"200":{"description":"Success","schema":{"type":"string"}},"401":{"description":"Unauthorized"},"500":{"description":"Failure","schema":{"$ref":"#/definitions/Error"}}}}},
"/v1/proxy/resource/mob/openTask":{"post":{"tags":["v1"],"summary":"Open a task","description":"API to Open a task","operationId":"openTaskUsingPOSTUsingPOST","consumes":["application/json"],"produces":["text/plain"],"parameters":[{"in":"body","name":"cmd","description":"cmd","required":true,"schema":{"$ref":"#/definitions/OpenTaskCmd"}}],"responses":{"200":{"description":"Success","schema":{"type":"string"}},"401":{"description":"Unauthorized"},"500":{"description":"Failure"}}}},
"/v1/proxy/resource/mob/readActivities":{"get":{...,"responses":{"200":{"description":"Success","schema":{"type":"string"}},"401":{"description":"Unauthorized"},"500":{"description":"Failure","schema":{"$ref":"#/definitions/Error"}}}}}},
"definitions":{"OpenTaskCmd":{...}}}}}
Json有两个问题我不明白:
有两件事可以尝试:
>
从哲学上讲,我们不希望在运行时使用对服务描述不重要的注释。例如,jackson注释应该总是胜过@ApiModelProperty或具有更多的权重,例如,@NotNull或指定@刚需
应该总是获胜。注释仅用于补充留档或在无法推断服务/模式特征的情况下覆盖/调整结果规范。
我正在尝试搜索亚马逊的产品广告,并使用botlenose来帮助我做到这一点。但是,我刚刚收到HTTP错误400。 其他一些重要信息: 我来自巴西,我的标签也来自亚马逊。这是个问题吗? 我确实检查了我的钥匙、秘密和标签,一切正常。我确实在StackOverflow上查看了其他一些问题,但对我来说没有任何效果。 当然,出于安全原因,我更改了密钥。 Traceback(最近一次调用最后一次):File"
我有一个基于Spring Web model view controller(MVC)框架的项目。Spring Web模型-视图-控制器(MVC)框架的版本是3.2.8 我有这个控制器 这个URL一切正常:
目前从Angular JS controller中,我试图将JSON数据发送到后端服务。但是我有400个错误的请求错误。 在Controller中,我试图通过http服务发送数据,如下所示:
我得到了这个错误,有什么想法会导致它吗?我试图发送一个DTO,它有一个扩展抽象类的对象列表,我想这个问题可能是因为DTO中的列表,还是因为抽象类的子类?
在月食中, ”org.apache.axis2。AxisFault:传输错误: 403错误:禁止”试图从svn检出项目时发生错误。我不能实现这个错误,因此我检查了从终端使用"svn-co"命令的项目。 但是,有趣的是,当我试图在Eclipse中运行应用程序时,在输入凭据(用户名和密码)并按下“登录”按钮之后,我又遇到了相同的错误。响应是JFrame上的无效用户名/密码,但凭据没有错误。这只发生在日
Errors 错误 Library routines must often return some sort of error indication to the caller. As mentioned earlier, Go’s multivalue return makes it easy to return a detailed error description alongside th
本章概述了Google API错误模型,以及开发人员如何正确生成和处理错误的一般指南。 Google API使用简单的协议无关错误模型,这使我们能够在不同的API,API协议(如gRPC或HTTP)以及错误上下文(例如,异步,批处理或工作流错误)中获得一致的体验。 错误模型 错误模型在逻辑上由google.rpc.Status定义,当API发生错误时,返回一个Status实例给客户端。 以下代码段
5.4. 错误 在Go中有一部分函数总是能成功的运行。比如strings.Contains和strconv.FormatBool函数,对各种可能的输入都做了良好的处理,使得运行时几乎不会失败,除非遇到灾难性的、不可预料的情况,比如运行时的内存溢出。导致这种错误的原因很复杂,难以处理,从错误中恢复的可能性也很低。 还有一部分函数只要输入的参数满足一定条件,也能保证运行成功。比如time.Date函数