Java 类springfox.documentation.builders.ResponseMessageBuilder 实例源码

项目:spring-boot-oauth2-demo    文件:SpringfoxConfig.java   
@Bean
public Docket practiceApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.sdcuike.practice"))
            .paths(PathSelectors.any())
            .build()
            .pathMapping("/")
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                            typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder()
                            .code(500)
                            .message("500 message")
                            .responseModel(new ModelRef("Error"))
                            .build()))
            .enableUrlTemplating(true)
            .tags(new Tag("Pet Service", "All apis relating to pets"));
}
项目:spring-boot-oauth2-demo    文件:SpringfoxConfig.java   
@Bean
public Docket practiceApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.sdcuike.practice"))
            .paths(PathSelectors.any())
            .build()
            .pathMapping("/")
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                            typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder()
                            .code(500)
                            .message("500 message")
                            .responseModel(new ModelRef("Error"))
                            .build()))
            .enableUrlTemplating(true)
            .tags(new Tag("Pet Service", "All apis relating to pets"));
}
项目:spid-spring    文件:SpidSpringRestApplication.java   
private List<ResponseMessage> errorList() {
    List<ResponseMessage> lista = new ArrayList<ResponseMessage>();
    lista.add(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("ErrorRestService")).build());
    lista.add(new ResponseMessageBuilder().code(400).message("Bad Request").responseModel(new ModelRef("ErrorRestService")).build());
    lista.add(new ResponseMessageBuilder().code(401).message("Non Autorizzato").responseModel(new ModelRef("ErrorRestService")).build());
    lista.add(new ResponseMessageBuilder().code(412).message("Errore Validazione").responseModel(new ModelRef("ErrorRestService")).build());
    return lista;
}
项目:interview-preparation    文件:ApiDocumentationConfig.java   
@Bean
public Docket petApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            // .apis(RequestHandlerSelectors.any())
            .apis(RequestHandlerSelectors.basePackage("com.tvajjala.resource"))
            .paths(PathSelectors.any())
            // .paths(PathSelectors.ant("/api/*"))
            .build()
            .apiInfo(apiInfo())
            .pathMapping("/api")
            // .directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class, typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build()))
            .securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));
}
项目:interview-preparation    文件:ApiDocumentationConfig.java   
@Bean
public Docket petApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            // .apis(RequestHandlerSelectors.any())
            .apis(RequestHandlerSelectors.basePackage("com.tvajjala.web.resource"))
            .paths(PathSelectors.any())
            // .paths(PathSelectors.ant("/api/*"))
            .build()
            .apiInfo(apiInfo())
            .pathMapping("/api")
            // .directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class, typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build()))
            .securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));
}
项目:MedicamentDB    文件:SwaggerConfig.java   
@Bean
public Docket medicamentApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.regex("/api/.*"))
            .build()
            .pathMapping("/")
            .apiInfo(apiInfo())
            .directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                                    typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder()
                            .code(500)
                            .message("500 message")
                            .responseModel(new ModelRef("Error"))
                            .build()))
            .enableUrlTemplating(false);
}
项目:peregrine    文件:Boot.java   
@Bean
public Docket petApi() {
    return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build().pathMapping("/")
            .apiInfo(new ApiInfo(
                            "Peregrine Event Service",
                            "Peregrine Event Service is a canonical implementation of the Event store pattern",
                            "0.0.1",
                            "",
                            "Alliance Foundry, a Fidelity Investments Open Source Project",
                            "Apache 2.0",
                            "http://www.apache.org/licenses/LICENSE-2.0.html"))
            .consumes(new HashSet<String>(Arrays.asList("application/json")))
            .produces(new HashSet<String>(Arrays.asList("application/json")))
            .protocols(new HashSet<String>(Arrays.asList("http")))
            .directModelSubstitute(LocalDate.class, String.class)
            .directModelSubstitute(DateTime.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(newRule(typeResolver.resolve(DeferredResult.class, typeResolver.resolve(ResponseEntity.class, WildcardType.class)), typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build()));
            //.securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));
}
项目:happylifeplat-transaction    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:happylifeplat-transaction    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:happylifeplat-transaction    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:happylifeplat-tcc    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:happylifeplat-tcc    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:happylifeplat-tcc    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:myth    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:myth    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:myth    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:myth    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            // .paths(paths())
            .build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
                    .responseModel(new ModelRef("Error")).build()));
}
项目:tc    文件:TcSwaggerConfig.java   
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build()
            .host("www.tc.com")
            .pathMapping("/")
            .genericModelSubstitutes(ResponseEntity.class)
            .useDefaultResponseMessages(false)
            .globalResponseMessage(
                    RequestMethod.GET,
                    Lists.newArrayList(
                            new ResponseMessageBuilder()
                                    .code(HttpStatus.OK.value())
                                    .message("请求成功")
                                    .responseModel(new ModelRef("TcR"))
                                    .build()
                    )
            )
            .globalResponseMessage(
                    RequestMethod.POST,
                    Lists.newArrayList(
                            new ResponseMessageBuilder()
                                    .code(HttpStatus.OK.value())
                                    .message("请求成功")
                                    .responseModel(new ModelRef("TcR"))
                                    .build()
                    )
            )
            .protocols(Sets.newHashSet("http", "https"));
}
项目:availability    文件:SwaggerConfig.java   
@Bean
public Docket api() {
  return new Docket(DocumentationType.SWAGGER_2)
      .select()
        .apis(RequestHandlerSelectors.any())
        .paths(PathSelectors.any())
        .build()
      .pathMapping("/")
      .directModelSubstitute(LocalDate.class,
          String.class)
      .genericModelSubstitutes(ResponseEntity.class)
      .alternateTypeRules(
          newRule(typeResolver.resolve(DeferredResult.class,
                  typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
              typeResolver.resolve(WildcardType.class)))
      .useDefaultResponseMessages(false)
      .globalResponseMessage(RequestMethod.GET,
          newArrayList(new ResponseMessageBuilder()
              .code(500)
              .message("500 message")
              .responseModel(new ModelRef("Error"))
              .build()))
      .securitySchemes(newArrayList(apiKey()))
      .securityContexts(newArrayList(securityContext()))
      .enableUrlTemplating(true)
      ;
}
项目:SpringBoot-Swagger2    文件:Application.java   
@Bean
public Docket petApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build()
            .pathMapping("/")
            .directModelSubstitute(LocalDate.class,
                    String.class)
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                                    typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder()
                            .code(500)
                            .message("500 message")
                            .responseModel(new ModelRef("Error"))
                            .build()))
            .securitySchemes(newArrayList(apiKey()))
            .securityContexts(newArrayList(securityContext()))
            .enableUrlTemplating(false)
            ;
}
项目:the-turbine    文件:SwaggerSetup.java   
@Bean
public Docket petApi() {
  return new Docket(DocumentationType.SWAGGER_2)
      .select()
      .apis(RequestHandlerSelectors.any())
      .paths(PathSelectors.any())
      .build()
      .pathMapping("/")
      .directModelSubstitute(LocalDate.class,
          String.class)
      .genericModelSubstitutes(ResponseEntity.class)
      .alternateTypeRules(
          newRule(typeResolver.resolve(DeferredResult.class,
              typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
              typeResolver.resolve(WildcardType.class)))
      .useDefaultResponseMessages(false)
      .globalResponseMessage(RequestMethod.GET,
          asList(new ResponseMessageBuilder()
              .code(500)
              .message("500 message")
              .responseModel(new ModelRef("Error"))
              .build()))
      .securitySchemes(asList(apiKey()))
      .securityContexts(asList(securityContext()))
      .enableUrlTemplating(true)
  // .globalOperationParameters(
  // newArrayList(new ParameterBuilder()
  // .name("someGlobalParameter")
  // .description("Description of someGlobalParameter")
  // .modelRef(new ModelRef("string"))
  // .parameterType("query")
  // .required(true)
  // .build()))
  // .tags(new Tag("Pet Service", "All apis relating to pets"))
  // .additionalModels(typeResolver.resolve(AdditionalModel.class))
  ;
}
项目:apidoc    文件:ServletConfig.java   
@Bean
public Docket newsApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
            .protocols(Sets.newHashSet("https"))
            .pathMapping("/")
            .directModelSubstitute(Date.class, String.class)
            .directModelSubstitute(Locale.class, String.class)
            .useDefaultResponseMessages(false)
            .produces(Sets.newHashSet("application/json"))
            .additionalModels(typeResolver.resolve(NpResult.class))
            .globalResponseMessage(RequestMethod.GET,
                Lists.newArrayList(new ResponseMessageBuilder()
                    .code(500)
                    .message("500 message")
                    .responseModel(new ModelRef("NpRequest"))
                    .build()))
            //.securitySchemes(Lists.newArrayList(apiKey()))
            //.securityContexts(Lists.newArrayList(securityContext()))
            .enableUrlTemplating(true)
            /*.globalOperationParameters(
                Lists.newArrayList(new ParameterBuilder()
                    .name("someGlobalParameter")
                    .description("Description of someGlobalParameter")
                    .modelRef(new ModelRef("string"))
                    .parameterType("query")
                    .required(true)
                    .build()))*/
            .tags(new Tag("Pet Service", "All apis relating to pets"))
                ;
}
项目:plumdo-work    文件:Swagger2Configuration.java   
private List<ResponseMessage> getDefaultResponseMessage(){
    List<ResponseMessage> responseMessages =new ArrayList<ResponseMessage>();
    responseMessages.add(new ResponseMessageBuilder().code(500).message(error.get("500")).responseModel(new ModelRef("ErrorInfo")).build());
    responseMessages.add(new ResponseMessageBuilder().code(404).message(error.get("404")).responseModel(new ModelRef("ErrorInfo")).build());
    return responseMessages;
}
项目:plumdo-work    文件:Swagger2Configuration.java   
private List<ResponseMessage> getDefaultResponseMessage(){
    List<ResponseMessage> responseMessages =new ArrayList<ResponseMessage>();
    responseMessages.add(new ResponseMessageBuilder().code(500).message(error.get("500")).responseModel(new ModelRef("ErrorInfo")).build());
    responseMessages.add(new ResponseMessageBuilder().code(404).message(error.get("404")).responseModel(new ModelRef("ErrorInfo")).build());
    return responseMessages;
}
项目:cerebro    文件:App.java   
private List<ResponseMessage> responseMessageList() {
    return newArrayList(new ResponseMessageBuilder().code(500).message("Server Error").responseModel(new ModelRef("Error")).build(),
        new ResponseMessageBuilder().code(401).message("Unauthorized").build());
}