本文整理汇总了Java中io.swagger.annotations.ResponseHeader类的典型用法代码示例。如果您正苦于以下问题:Java ResponseHeader类的具体用法?Java ResponseHeader怎么用?Java ResponseHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResponseHeader类属于io.swagger.annotations包,在下文中一共展示了ResponseHeader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ApiResponses({@ApiResponse(code = 400, response = String.class, message = ""),
@ApiResponse(
code = 401,
response = long.class,
message = "",
responseHeaders = {@ResponseHeader(name = "h1", response = int.class)})
})
public int add(int x, int y) {
return x + y;
}
示例2: parseResponseHeaders
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
private static Map<String, Property> parseResponseHeaders(ReaderContext context,
ResponseHeader[] headers) {
Map<String, Property> responseHeaders = null;
for (ResponseHeader header : headers) {
final String name = header.name();
if (StringUtils.isNotEmpty(name)) {
if (responseHeaders == null) {
responseHeaders = new HashMap<String, Property>();
}
final Class<?> cls = header.response();
if (!ReflectionUtils.isVoid(cls)) {
final Property property = ModelConverters.getInstance().readAsProperty(cls);
if (property != null) {
final Property responseProperty = ContainerWrapper.wrapContainer(
header.responseContainer(), property, ContainerWrapper.ARRAY,
ContainerWrapper.LIST, ContainerWrapper.SET);
responseProperty.setDescription(header.description());
responseHeaders.put(name, responseProperty);
appendModels(context.getSwagger(), cls);
}
}
}
}
return responseHeaders;
}
示例3: responseEntity
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
@ResponseHeader(name = "h2", response = String.class)})
@PostMapping(path = "/responseEntity")
@Override
public ResponseEntity<Date> responseEntity(InvocationContext c1, @RequestAttribute("date") Date date) {
return super.responseEntity(c1, date);
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:8,代码来源:CodeFirstSpringmvcSimplifiedMappingAnnotation.java
示例4: cseResponse
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ApiResponse(code = 200, response = User.class, message = "")
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
@ResponseHeader(name = "h2", response = String.class)})
@GetMapping(path = "/cseResponse")
@Override
public Response cseResponse(InvocationContext c1) {
return super.cseResponse(c1);
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:CodeFirstSpringmvcSimplifiedMappingAnnotation.java
示例5: responseEntity
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
@ResponseHeader(name = "h2", response = String.class)})
@RequestMapping(path = "/responseEntity", method = RequestMethod.POST)
@Override
public ResponseEntity<Date> responseEntity(InvocationContext c1, @RequestAttribute("date") Date date) {
return super.responseEntity(c1, date);
}
示例6: cseResponse
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ApiResponse(code = 200, response = User.class, message = "")
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
@ResponseHeader(name = "h2", response = String.class)})
@RequestMapping(path = "/cseResponse", method = RequestMethod.GET)
@Override
public Response cseResponse(InvocationContext c1) {
return super.cseResponse(c1);
}
示例7: responseEntity
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
@ResponseHeader(name = "h2", response = String.class)})
@RequestMapping(path = "/responseEntity", method = RequestMethod.POST)
public ResponseEntity<Date> responseEntity(InvocationContext c1, @RequestAttribute("date") Date date) {
HttpHeaders headers = new HttpHeaders();
headers.add("h1", "h1v " + c1.getContext().get(Const.SRC_MICROSERVICE).toString());
InvocationContext c2 = ContextUtils.getInvocationContext();
headers.add("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE).toString());
return new ResponseEntity<Date>(date, headers, HttpStatus.ACCEPTED);
}
示例8: responseEntityPATCH
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
@ResponseHeader(name = "h2", response = String.class)})
@RequestMapping(path = "/responseEntity", method = RequestMethod.PATCH)
public ResponseEntity<Date> responseEntityPATCH(InvocationContext c1, @RequestAttribute("date") Date date) {
HttpHeaders headers = new HttpHeaders();
headers.add("h1", "h1v " + c1.getContext().get(Const.SRC_MICROSERVICE).toString());
InvocationContext c2 = ContextUtils.getInvocationContext();
headers.add("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE).toString());
return new ResponseEntity<Date>(date, headers, HttpStatus.ACCEPTED);
}
示例9: process
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
ResponseHeaders responseHeaders = (ResponseHeaders) annotation;
MethodAnnotationProcessor processor =
operationGenerator.getContext().findMethodAnnotationProcessor(ResponseHeader.class);
for (ResponseHeader responseHeader : responseHeaders.value()) {
processor.process(responseHeader, operationGenerator);
}
}
示例10: convert
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
public static ResponseHeaderConfig convert(ResponseHeader responseHeader) {
if (StringUtils.isEmpty(responseHeader.name())) {
return null;
}
ResponseHeaderConfig config = new ResponseHeaderConfig();
config.setName(responseHeader.name());
config.setDescription(responseHeader.description());
config.setResponseClass(responseHeader.response());
config.setResponseContainer(responseHeader.responseContainer());
return config;
}
示例11: setResponseHeaders
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
public void setResponseHeaders(ResponseHeader[] responseHeaders) {
this.responseHeaders = new ArrayList<>();
for (ResponseHeader header : responseHeaders) {
ResponseHeaderConfig config = AnnotationUtils.convert(header);
if (config != null) {
this.responseHeaders.add(config);
}
}
if (this.responseHeaders.isEmpty()) {
this.responseHeaders = null;
}
}
示例12: process
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
ResponseHeader responseHeader = (ResponseHeader) annotation;
ResponseHeaderConfig config = AnnotationUtils.convert(responseHeader);
if (config != null) {
Property property =
AnnotationUtils.generateResponseHeaderProperty(operationGenerator.getSwagger(), config);
operationGenerator.addResponseHeader(config.getName(), property);
}
}
示例13: initMethodAnnotationMgr
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
protected void initMethodAnnotationMgr() {
methodAnnotationMgr.register(ApiOperation.class, new ApiOperationProcessor());
methodAnnotationMgr.register(ApiImplicitParams.class, new ApiImplicitParamsMethodProcessor());
methodAnnotationMgr.register(ApiImplicitParam.class, new ApiImplicitParamMethodProcessor());
methodAnnotationMgr.register(ApiResponses.class, new ApiResponsesMethodProcessor());
methodAnnotationMgr.register(ApiResponse.class, new ApiResponseMethodProcessor());
methodAnnotationMgr.register(ResponseHeaders.class, new ResponseHeadersProcessor());
methodAnnotationMgr.register(ResponseHeader.class, new ResponseHeaderProcessor());
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:13,代码来源:AbstractSwaggerGeneratorContext.java
示例14: testBase
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ApiOperation(
value = "summary",
notes = "notes",
tags = {"tag1", "tag2"},
httpMethod = "GET",
nickname = "test",
produces = "application/json",
consumes = "application/json",
protocols = "http,https",
code = 202,
responseHeaders = {@ResponseHeader(name = "h1", response = int.class)},
extensions = {@Extension(
name = "x-tagA",
properties = {@ExtensionProperty(name = "x-tagAExt", value = "value of tagAExt")})})
void testBase();
示例15: test
import io.swagger.annotations.ResponseHeader; //导入依赖的package包/类
@ApiResponse(
code = 300,
response = String.class,
message = "",
responseHeaders = {@ResponseHeader(name = "h3", response = int.class)})
@ResponseHeaders({@ResponseHeader(name = "h1", response = int.class),
@ResponseHeader(name = "h2", response = String.class, responseContainer = "List")})
public int test(int x) {
return 100;
}