Невозможно выполнить методы Rest из пользовательского интерфейса Swagger и Thorntail - PullRequest
0 голосов
/ 19 января 2019


Я заметил, что при создании REST-приложения Thorntail с использованием зависимостей пользовательского интерфейса JAX-RS и Swagger вызов REST, генерируемый пользовательским интерфейсом Swagger, использует https вместо http . Вот служба REST, которую я использую:

@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());
    }
}

И зависимости:

<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:

curl -X GET "https://localhost:8080/time/now" -H  "accept: application/json"

, который возвращает:

curl: (35) SSL received a record that exceeded the maximum permissible length.

Есть ли какой-либо параметр (@Api?), Который заставляет использовать 'http' вместо 'https'?

1 Ответ

0 голосов
/ 05 февраля 2019

Со своей стороны я использовал эту конфигурацию в project-defaults.yml

thorntail:
  deployment:
    my-webapp.war:
      swagger:
        schemes:
          - http
...