我是这个主题的初学者,我需要一些有用的文章和你的指导.我想构建RESTFulAPI Web服务.作为http服务器选择nginx.但我不知道(无法找到任何文章)任何关于如何将我的查询重定向到我的java模块,它处理请求并返回JSON到nginx.如果我对后端类型的想法不正确,请帮我弄清楚这个......
Request method 'PUT' not supported我在使用Restful API 上的PUT方法上传文件时遇到错误。
以下是上传到此票证的信息。
$ curl -X PUT -T "/cygdrive/c/a/documents/test.pptx" http://localhost:8080/piranha-storage-service/buckets/gnaval.bucket1/test.pptx
<html><head><title>Apache Tomcat/7.0.52 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 405 - Request method 'PUT' not supported</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Request method 'PUT' not supported</u></p><p><b>description</b> <u>The specified HTTP method is not allowed for the requested …Run Code Online (Sandbox Code Playgroud) 我在模拟JdbcTemplate用于单元测试用例,因为不想达到实际的数据库集成。
但这正在减少我的代码覆盖率(红色表示缺少覆盖率)。

以下是使用的代码段。使用用户定义的映射器也会发生相同的情况。
final List<String> resultList = new ArrayList<String>();
resultList.add("test1");
resultList.add("test2");
final JdbcTemplate template = Mockito.mock(JdbcTemplate.class);
Mockito.when(
template.query(Mockito.anyString(), Mockito.any(Object[].class),
Mockito.any(RowMapper.class))).thenReturn(resultList);
sampleDao.setJdbcTemplate(template);
Run Code Online (Sandbox Code Playgroud)
有关increasing codedao类的任何想法。在我的情况下,所有方法都不适合用户定义的行映射器。
rest ×2
jacoco ×1
java ×1
mockito ×1
nginx ×1
put ×1
spring ×1
spring-boot ×1
unit-testing ×1
web-services ×1