首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从Swagger和Thorntail执行Rest方法

无法从Swagger和Thorntail执行Rest方法
EN

Stack Overflow用户
提问于 2019-01-19 10:17:11
回答 1查看 145关注 0票数 1

我注意到,当使用JAX和Swagger依赖项构建Thorntail REST应用程序时,Swagger生成的REST调用使用https而不是http。这是我正在使用的REST服务:

代码语言:javascript
复制
@Path("/time")
@Api(value = "/time", description = "Get the time", tags = "time")
@Produces(MediaType.APPLICATION_JSON)
public class HelloWorldEndpoint {

    @GET
    @Path("/now")
    @ApiOperation(value = "Get the current time",
            notes = "Returns the time as a string",
            response = String.class
    )
    @Produces(MediaType.APPLICATION_JSON)
    public String get() {
        return String.format("{\"value\" : \"The time is %s\"}", new Date());
    }
}

以及依赖关系:

代码语言:javascript
复制
<dependency>
  <groupId>io.thorntail</groupId>
  <artifactId>swagger</artifactId>
</dependency>
 <dependency>
  <groupId>io.thorntail</groupId>
  <artifactId>jaxrs</artifactId>
</dependency>
<dependency>
  <groupId>io.thorntail</groupId>
  <artifactId>swagger-webapp</artifactId>
</dependency>

在这种情况下,生成的REST调用是:

代码语言:javascript
复制
curl -X GET "https://localhost:8080/time/now" -H  "accept: application/json"

返回:

代码语言:javascript
复制
curl: (35) SSL received a record that exceeded the maximum permissible length.

是否有任何参数(@Api ?)强制使用'http‘而不是'https’?

EN

回答 1

Stack Overflow用户

发布于 2019-02-05 10:14:51

在我这方面,我在project-defaults.yml中使用了这个配置

代码语言:javascript
复制
thorntail:
  deployment:
    my-webapp.war:
      swagger:
        schemes:
          - http
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54266064

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档