【发布时间】:2018-11-04 16:26:39
【问题描述】:
我们的后端有 RESTful API,而这项重要的服务需要 1 多分钟才能准备好响应。
所以大约 90 秒后响应准备就绪,进程完成,但浏览器没有从服务器获得任何响应(待定),然后最终失败(下图)。我已经用低数据测试了服务器,并批准它只有在响应需要超过 1 分钟才能准备好时才会发生。我该如何解决这个问题?
Response failed after nothing happens
这是服务:
@POST
@Path("/search")
public Response hotelSearch(@RequestBody InputValues value) {
/* sending request to several other API
retrieving data from PostgreSQL DB
creating a big DTO
*/
return Response.ok(DTO).build();
}
注意:我们使用的是 apache-tomcat 9.0.8 ,JAVA 8! 导入的依赖项:
compile 'org.springframework:spring-web:4.3.6.RELEASE'
compile 'org.springframework:spring-orm:4.0.2.RELEASE'
compile 'org.springframework:spring-aspects:4.0.2.RELEASE'
compile 'org.springframework.security:spring-security-web:3.2.1.RELEASE'
compile 'org.springframework.security:spring-security-config:3.2.1.RELEASE'
compile 'org.springframework.security:spring-security-cas:3.2.1.RELEASE
compile 'org.glassfish.jersey.ext:jersey-spring3:2.6'
【问题讨论】:
-
请阅读Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - 总结是这不是解决志愿者的理想方式,并且可能会适得其反。请不要将此添加到您的问题中。