本文整理汇总了Java中springfox.documentation.builders.ResponseMessageBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ResponseMessageBuilder类的具体用法?Java ResponseMessageBuilder怎么用?Java ResponseMessageBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResponseMessageBuilder类属于springfox.documentation.builders包,在下文中一共展示了ResponseMessageBuilder类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: practiceApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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"));
}
示例2: errorList
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
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;
}
示例3: petApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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()));
}
示例4: petApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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()));
}
示例5: medicamentApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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);
}
示例6: petApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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()));
}
示例7: api
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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()));
}
示例8: createRestApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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"));
}
示例9: api
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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)
;
}
示例10: petApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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)
;
}
示例11: petApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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))
;
}
示例12: newsApi
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
@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"))
;
}
示例13: getDefaultResponseMessage
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
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;
}
示例14: responseMessageList
import springfox.documentation.builders.ResponseMessageBuilder; //导入依赖的package包/类
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());
}