Java 类io.swagger.annotations.ResponseHeader 实例源码

项目:swagger-dubbo    文件:DubboReaderExtension.java   
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;
}
项目:incubator-servicecomb-java-chassis    文件:CodeFirstSpringmvcSimplifiedMappingAnnotation.java   
@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);
}
项目:incubator-servicecomb-java-chassis    文件:CodeFirstSpringmvcSimplifiedMappingAnnotation.java   
@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);
}
项目:incubator-servicecomb-java-chassis    文件:CodeFirstSpringmvc.java   
@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);
}
项目:incubator-servicecomb-java-chassis    文件:CodeFirstSpringmvc.java   
@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);
}
项目:incubator-servicecomb-java-chassis    文件:CodeFirstSpringmvc.java   
@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);
}
项目:incubator-servicecomb-java-chassis    文件:CodeFirstSpringmvc.java   
@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);
}
项目:incubator-servicecomb-java-chassis    文件:ResponseHeadersProcessor.java   
@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);
  }
}
项目:incubator-servicecomb-java-chassis    文件:AnnotationUtils.java   
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;
}
项目:incubator-servicecomb-java-chassis    文件:ResponseConfig.java   
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;
  }
}
项目:incubator-servicecomb-java-chassis    文件:ResponseHeaderProcessor.java   
@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);
  }
}
项目:incubator-servicecomb-java-chassis    文件:AbstractSwaggerGeneratorContext.java   
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());
}
项目:incubator-servicecomb-java-chassis    文件:TestApiOperation.java   
@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();
项目:incubator-servicecomb-java-chassis    文件:TestResponsesMeta.java   
@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;
}
项目:incubator-servicecomb-java-chassis    文件:TestOperationMeta.java   
@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;
}
项目:comms-router    文件:TaskResource.java   
@POST
@ApiOperation(
    value = "Add new Task",
    notes = "Create a new Task within a Router")
@ApiResponses(
    @ApiResponse(
        code = 201,
        message = "Created successfully",
        response = CreatedTaskDto.class,
        responseHeaders = {
            @ResponseHeader(
                name = HttpHeaders.LOCATION,
                response = URL.class,
                description = "The path to the newly created resource"),
            @ResponseHeader(
                name = TaskService.X_QUEUE_SIZE,
                response = Long.class,
                description = "The number of tasks in the queue before that one")}))
public Response create(CreateTaskArg taskArg)
    throws CommsRouterException {

  LOGGER.debug("Creating Task: {}", taskArg);

  CreatedTaskDto task = taskService.create(taskArg, routerRef);

  return createResponse(task);
}
项目:comms-router    文件:RouterResource.java   
@POST
@ApiOperation(
    value = "Create a Router",
    notes = "A Router is a container for your Tasks, Agents, Tasks, Plans and Rules.",
    response = ApiObjectRef.class,
    code = 201,
    tags = "routers")
@ApiResponses(
    @ApiResponse(code = 201, message = "Created",
        responseHeaders = @ResponseHeader(
            name = HttpHeaders.LOCATION,
            response = URL.class,
            description = "The path to the newly created resource")))
public Response create(
    @ApiParam(value = "Router object that needs to be added to the list of routers",
        required = true) CreateRouterArg routerArg)
    throws CommsRouterException {

  LOGGER.debug("Creating router: {}", routerArg);

  ApiObjectRef router = routerService.create(routerArg);

  URI createLocation =
      UriBuilder.fromResource(this.getClass()).path("{id}").build(router.getRef());

  return Response.status(Status.CREATED)
      .header(HttpHeaders.LOCATION, createLocation.toString())
      .entity(new ApiObjectRef(router))
      .build();
}
项目:microservices-transactions-tcc    文件:CompositeController.java   
@POST
@Path("files")
@Produces ( "application/json" )
   @ApiOperation(
        code = 201,
           value = "Save new content while creating its discussion board",
           notes = "Both operations (new content and forum) must succeed within a given time interval, otherwise both will be canceled or rolled back. "
                + "The newly created resource(s) can be referenced by the URI(s) returned in the entity of the response, with the URI for the "
                + "distributed transaction given by the Location header field",
           response = String.class,
           responseContainer = "List",
           responseHeaders = {
             @ResponseHeader(name = "Location", description = "The distributed transaction URI", response = String.class)
        }
       )
@ApiResponses(value = {
        @ApiResponse(code=500, message="Error processing request", response = ErrorDetails.class)
})
public Response save(@Context UriInfo uriInfo, 
        @ApiParam(value = "Data to pass to server", required = true) CompositeData data
        ) throws CompositeTransactionException {

    Entry<String, List<String>> txEntities = service.saveAllEntities(data);

    URI location = uriInfo.getAbsolutePathBuilder().path("{id}")
            .resolveTemplate("id", txEntities.getKey()).build();

    return Response.created(location).entity(txEntities.getValue()).build();
}
项目:EDDI    文件:IRestExportService.java   
@POST
@Path("{botId}")
@ApiResponse(code = 200, responseHeaders = {
        @ResponseHeader(name = "location", response = URI.class)
}, message = "returns location of the exported ZIP file to be downloaded")
Response exportBot(@PathParam("botId") String botId,
                   @ApiParam(name = "botVersion", required = true, format = "integer", example = "1")
                   @QueryParam("botVersion") @DefaultValue("1") Integer botVersion);
项目:Gaffer    文件:IGraphConfigurationServiceV2.java   
@GET
@Path("/filterFunctions")
@ApiOperation(value = "Gets available filter functions.",
        response = String.class,
        responseContainer = "list",
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR)})
Response getFilterFunction();
项目:coner-core    文件:EventsResource.java   
@POST
@UnitOfWork
@ApiOperation(value = "Add an Event", response = Response.class)
@ApiResponses({
        @ApiResponse(
                code = HttpStatus.CREATED_201,
                message = ApiResponseConstants.Created.MESSAGE,
                responseHeaders = {
                        @ResponseHeader(
                                name = ApiResponseConstants.Created.Headers.NAME,
                                description = ApiResponseConstants.Created.Headers.DESCRIPTION,
                                response = String.class
                        )
                }
        ),
        @ApiResponse(
                code = HttpStatus.UNPROCESSABLE_ENTITY_422,
                response = ValidationErrorMessage.class,
                message = "Failed validation"
        )
})
public Response addEvent(
        @Valid @ApiParam(value = "Event", required = true) AddEventRequest request
) throws AddEntityException {
    EventAddPayload addPayload = eventMapper.toDomainAddPayload(request);
    Event domainEntity = eventEntityService.add(addPayload);
    EventApiEntity eventApiEntity = eventMapper.toApiEntity(domainEntity);
    return Response.created(UriBuilder.fromPath("/events/{eventId}")
            .build(eventApiEntity.getId()))
            .build();
}
项目:Gaffer    文件:IJobServiceV2.java   
@GET
@Path("{id}")
@ApiOperation(value = "Get the details of a job",
        response = JobDetail.class,
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = JOB_ID_HEADER, description = JOB_ID_HEADER_DESCRIPTION),
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK),
        @ApiResponse(code = 404, message = JOB_NOT_FOUND),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR),
        @ApiResponse(code = 503, message = JOB_SERVICE_UNAVAILABLE)})
Response details(@ApiParam(value = "a job id") @PathParam("id") final String id) throws OperationException;
项目:Gaffer    文件:IJobServiceV2.java   
@GET
@ApiOperation(value = "Get the details of all jobs",
        response = JobDetail.class,
        responseContainer = "List",
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = JOB_ID_HEADER, description = JOB_ID_HEADER_DESCRIPTION),
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR),
        @ApiResponse(code = 503, message = JOB_SERVICE_UNAVAILABLE)})
Response details() throws OperationException;
项目:Gaffer    文件:IGraphConfigurationServiceV2.java   
@GET
@Path("/serialisedFields/{className}")
@ApiOperation(value = "Gets all serialised fields for a given java class.",
        response = String.class,
        responseContainer = "list",
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK),
        @ApiResponse(code = 404, message = CLASS_NOT_FOUND),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR)})
Response getSerialisedFields(@ApiParam(value = "a java class name") @PathParam("className") final String className);
项目:coner-core    文件:HandicapGroupsResource.java   
@POST
@UnitOfWork
@ApiOperation(value = "Add a Handicap Group")
@ApiResponses({
        @ApiResponse(
                code = HttpStatus.CREATED_201,
                message = ApiResponseConstants.Created.MESSAGE,
                responseHeaders = {
                        @ResponseHeader(
                                name = ApiResponseConstants.Created.Headers.NAME,
                                description = ApiResponseConstants.Created.Headers.DESCRIPTION,
                                response = String.class
                        )
                }
        ),
        @ApiResponse(
                code = HttpStatus.UNPROCESSABLE_ENTITY_422,
                message = "Failed validation",
                response = ValidationErrorMessage.class
        )
})
public Response addHandicapGroup(
        @Valid @ApiParam(value = "Handicap Group") AddHandicapGroupRequest request
) throws AddEntityException {
    HandicapGroupAddPayload addPayload = handicapGroupMapper.toDomainAddPayload(request);
    HandicapGroup domainEntity = handicapGroupEntityService.add(addPayload);
    HandicapGroupApiEntity entity = handicapGroupMapper.toApiEntity(domainEntity);
    return Response.created(UriBuilder.fromPath("/handicapGroups/{handicapGroupId}")
            .build(entity.getId()))
            .build();
}
项目:Gaffer    文件:IOperationServiceV2.java   
@GET
@ApiOperation(value = "Gets all operations supported by the store.",
        response = String.class,
        responseContainer = "list",
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK)})
Response getOperations();
项目:coner-core    文件:CompetitionGroupsResource.java   
@POST
@UnitOfWork
@ApiOperation(value = "Add a Competition Group")
@ApiResponses({
        @ApiResponse(
                code = HttpStatus.CREATED_201,
                message = ApiResponseConstants.Created.MESSAGE,
                responseHeaders = {
                        @ResponseHeader(
                                name = ApiResponseConstants.Created.Headers.NAME,
                                description = ApiResponseConstants.Created.Headers.DESCRIPTION,
                                response = String.class
                        )
                }
        ),
        @ApiResponse(
                code = HttpStatus.UNPROCESSABLE_ENTITY_422,
                message = "Failed validation",
                response = ValidationErrorMessage.class
        )
})
public Response addCompetitionGroup(
        @Valid @ApiParam(value = "Competition Group") AddCompetitionGroupRequest request
) throws AddEntityException {
    CompetitionGroupAddPayload addPayload = competitionGroupMapper.toDomainAddPayload(request);
    CompetitionGroup domainEntity = competitionGroupEntityService.add(addPayload);
    CompetitionGroupApiEntity entity = competitionGroupMapper.toApiEntity(domainEntity);
    return Response.created(UriBuilder.fromPath("/competitionGroups/{competitionGroupId}")
            .build(entity.getId()))
            .build();
}
项目:coner-core    文件:EventRegistrationsResource.java   
@POST
@UnitOfWork
@ApiOperation(value = "Add a new registration")
@ApiResponses({
        @ApiResponse(
                code = HttpStatus.CREATED_201,
                message = ApiResponseConstants.Created.MESSAGE,
                responseHeaders = {
                        @ResponseHeader(
                                name = ApiResponseConstants.Created.Headers.NAME,
                                description = ApiResponseConstants.Created.Headers.DESCRIPTION,
                                response = String.class
                        )
                }
        ),
        @ApiResponse(
                code = HttpStatus.NOT_FOUND_404,
                response = ErrorMessage.class,
                message = "No event with given ID"
        ),
        @ApiResponse(
                code = HttpStatus.UNPROCESSABLE_ENTITY_422,
                response = ValidationErrorMessage.class,
                message = "Failed validation"
        )
})
public Response addRegistration(
        @PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
        @Valid @ApiParam(value = "Registration", required = true) AddRegistrationRequest request
) throws AddEntityException, EntityNotFoundException {
    RegistrationAddPayload addPayload = registrationMapper.toDomainAddPayload(request, eventId);
    Registration domainEntity = eventRegistrationService.add(addPayload);
    RegistrationApiEntity registration = registrationMapper.toApiEntity(domainEntity);
    return Response.created(UriBuilder.fromPath("/events/{eventId}/registrations/{registrationId}")
            .build(eventId, registration.getId()))
            .build();
}
项目:Gaffer    文件:IJobServiceV2.java   
@POST
@ApiOperation(value = "Submits the given operation job to the graph",
        response = JobDetail.class, code = 201, produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = JOB_ID_HEADER, description = JOB_ID_HEADER_DESCRIPTION),
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 201, message = JOB_CREATED),
        @ApiResponse(code = 400, message = BAD_REQUEST),
        @ApiResponse(code = 403, message = FORBIDDEN),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR),
        @ApiResponse(code = 501, message = OPERATION_NOT_IMPLEMENTED),
        @ApiResponse(code = 503, message = JOB_SERVICE_UNAVAILABLE)})
Response executeJob(final Operation operation) throws OperationException;
项目:Gaffer    文件:IPropertiesServiceV2.java   
@GET
@Path("/{propertyName}")
@Produces({TEXT_PLAIN, APPLICATION_JSON})
@ApiOperation(value = "Gets the property value for the specified property name.",
        response = String.class,
        produces = TEXT_PLAIN,
        responseHeaders = {
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK),
        @ApiResponse(code = 404, message = PROPERTY_NOT_FOUND),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR)})
Response getProperty(@ApiParam(value = "the property name") @PathParam("propertyName") final String propertyName);
项目:Gaffer    文件:IOperationServiceV2.java   
@POST
@Path("/execute")
@ApiOperation(value = "Performs the given operation on the graph",
        response = Object.class,
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = JOB_ID_HEADER, description = JOB_ID_HEADER_DESCRIPTION),
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK),
        @ApiResponse(code = 400, message = BAD_REQUEST),
        @ApiResponse(code = 403, message = FORBIDDEN),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR),
        @ApiResponse(code = 501, message = OPERATION_NOT_IMPLEMENTED)})
Response execute(final Operation operation);
项目:Gaffer    文件:IOperationServiceV2.java   
@GET
@Path("/{className}/example")
@ApiOperation(value = "Gets example JSON for the specified operation class.",
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK),
        @ApiResponse(code = 403, message = FORBIDDEN),
        @ApiResponse(code = 404, message = OPERATION_NOT_FOUND),
        @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR)})
Response operationExample(@ApiParam(value = "the fully qualified class name") @PathParam("className") final String className) throws InstantiationException, IllegalAccessException;
项目:Gaffer    文件:IPropertiesServiceV2.java   
@GET
@Path("/")
@ApiOperation(value = "Gets all available properties",
        response = Map.class,
        produces = APPLICATION_JSON,
        responseHeaders = {
                @ResponseHeader(name = GAFFER_MEDIA_TYPE_HEADER, description = GAFFER_MEDIA_TYPE_HEADER_DESCRIPTION)
        })
@ApiResponses(value = {@ApiResponse(code = 200, message = OK), @ApiResponse(code = 500, message = INTERNAL_SERVER_ERROR)})
Response getProperties();
项目:coner-core    文件:EventRunsResource.java   
@POST
@UnitOfWork
@ApiOperation(value = "Add a new run")
@ApiResponses({
        @ApiResponse(
                code = HttpStatus.CREATED_201,
                message = ApiResponseConstants.Created.MESSAGE,
                responseHeaders = {
                        @ResponseHeader(
                                name = ApiResponseConstants.Created.Headers.NAME,
                                description = ApiResponseConstants.Created.Headers.DESCRIPTION,
                                response = String.class
                        )
                }
        ),
        @ApiResponse(
                code = HttpStatus.NOT_FOUND_404,
                response = ErrorMessage.class,
                message = "No event with given ID"
        ),
        @ApiResponse(
                code = HttpStatus.UNPROCESSABLE_ENTITY_422,
                response = ValidationErrorMessage.class,
                message = "Failed validation"
        )
})
public Response addRun(
        @PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
        @Valid @ApiParam(value = "Run", required = true) AddRunRequest request
) throws AddEntityException, EntityNotFoundException {
    RunAddPayload addPayload = runMapper.toDomainAddPayload(request, eventId);
    Run domainEntity = runEntityService.add(addPayload);
    RunApiEntity run = runMapper.toApiEntity(domainEntity);
    return Response.created(UriBuilder.fromPath("/events/{eventId}/runs/{runId}")
                                    .build(eventId, run.getId()))
            .build();
}
项目:carbon-device-mgt    文件:UserManagementService.java   
@GET
@Path("/checkUser")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "GET",
        value = "Getting the User existence status",
        notes = "Check if the user exists in the user store.",
        tags = "User Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:is-exist")
            })
        }
)
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "OK. \n Successfully fetched user exist status.",
                response = BasicUserInfoList.class,
                responseHeaders = {
                        @ResponseHeader(
                                name = "Content-Type",
                                description = "The content type of the body")
                }),
        @ApiResponse(
                code = 406,
                message = "Not Acceptable.\n The requested media type is not supported",
                response = ErrorResponse.class),
        @ApiResponse(
                code = 500,
                message = "Internal Server Error. \n Server error occurred while fetching the " +
                        "total user exist status.",
                response = ErrorResponse.class)
})
Response isUserExists(@ApiParam(
                name = "username",
                value = "The username of the user.",
                required = true)
        @QueryParam("username") String userName);
项目:incubator-servicecomb-java-chassis    文件:TestApiResponse.java   
@ApiResponse(
    responseHeaders = {@ResponseHeader(name = "k1", response = int.class),
        @ResponseHeader(name = "k2", response = String.class)},
    code = 200,
    message = "")
void testApiResponseHeader();
项目:incubator-servicecomb-java-chassis    文件:TestApiResponse.java   
@ResponseHeader(name = "k1", response = int.class)
void testResponseHeader();
项目:comms-router    文件:GenericRouterObjectResource.java   
@GET
@ApiOperation(
    value = "List all resources",
    notes = "Default paging will be applied",
    responseContainer = "List")
@ApiResponses(
    @ApiResponse(
        code = 200,
        message = "Successful operation",
        responseHeaders = {
            @ResponseHeader(
                name = RouterObjectService.TOTAL_COUNT_HEADER,
                description = "The total items from this listing",
                response = Integer.class)}))
public Response list(
    @ApiParam(
        value = "The current page of the listing",
        defaultValue = "1",
        allowableValues = "range[1, infinity]")
    @Valid
    @Min(value = 1L, message = "{resource.list.min.page.number}")
    @DefaultValue("01")
    @QueryParam(RouterObjectService.PAGE_NUMBER_PARAM) int pageNum,
    @ApiParam(
        value = "Number of items per page (Maximum 50)",
        defaultValue = "10",
        allowableValues = "range[1, 50]")
    @Valid
    @Min(value = 1L, message = "{resource.list.min.items.per.page}")
    @Max(value = 50, message = "{resource.list.max.items.per.page}")
    @DefaultValue("10")
    @QueryParam(RouterObjectService.ITEMS_PER_PAGE_PARAM) int perPage)
    throws CommsRouterException {

  PaginatedList<T> pagedList = getService().list(routerRef, pageNum, perPage);

  LOGGER.debug("Listing page {}/{} for router {}: {}",
      pageNum, perPage, routerRef, pagedList);

  PaginationHelper paginationHelper = new PaginationHelper(
      () -> entryPoint.clone(),
      (builder) -> builder.build(routerRef));
  Link[] links = paginationHelper.getLinks(pagedList);

  GenericEntity<List<T>> genericEntity = new GenericEntity<>(pagedList.getList(), List.class);
  return Response.ok()
      .header(RouterObjectService.TOTAL_COUNT_HEADER, pagedList.getTotalCount())
      .links(links)
      .entity(genericEntity)
      .type(MediaType.APPLICATION_JSON_TYPE)
      .build();
}
项目:comms-router    文件:RouterResource.java   
@GET
@ApiOperation(value = "Get All Routers",
    notes = "Returns a list of Router. A single Router object represents "
        + "a container for Agents, Tasks, Queues and Plans.",
    response = RouterDto.class,
    responseContainer = "List",
    tags = "routers")
@ApiResponses(
    @ApiResponse(
        code = 200,
        message = "Successful operation",
        responseHeaders = {
            @ResponseHeader(
                name = PaginatedService.TOTAL_COUNT_HEADER,
                description = "The total items from this listing",
                response = Integer.class)}))
public Response list(
    @ApiParam(
        value = "The current page of the listing",
        defaultValue = "1",
        allowableValues = "range[1, infinity]")
    @Valid
    @Min(value = 1L, message = "{resource.list.min.page.number}")
    @DefaultValue("01")
    @QueryParam(PaginatedService.PAGE_NUMBER_PARAM) int pageNum,
    @ApiParam(
        value = "Number of items per page (Maximum 50)",
        defaultValue = "10",
        allowableValues = "range[1, 50]")
    @Valid
    @Min(value = 1L, message = "{resource.list.min.items.per.page}")
    @Max(value = 50, message = "{resource.list.max.items.per.page}")
    @DefaultValue("10")
    @QueryParam(PaginatedService.ITEMS_PER_PAGE_PARAM) int perPage)
    throws CommsRouterException {

  PaginatedList<RouterDto> pagedList = routerService.list(new PagingRequest(pageNum, perPage));

  LOGGER.debug("Listing all routers: {}", pagedList);

  PaginationHelper paginationHelper = new PaginationHelper(
      () -> UriBuilder.fromResource(this.getClass()).path(this.getClass()).clone(),
      (builder) -> builder.build());
  Link[] links = paginationHelper.getLinks(pagedList);

  GenericEntity<List<RouterDto>> genericEntity =
      new GenericEntity<>(pagedList.getList(), List.class);

  return Response.ok()
      .header(PaginatedService.TOTAL_COUNT_HEADER, pagedList.getTotalCount())
      .links(links)
      .entity(genericEntity)
      .type(MediaType.APPLICATION_JSON_TYPE)
      .build();
}
项目:mid-tier    文件:VirtualAccountServiceExposure.java   
@PUT
@RolesAllowed("system")
@Path("{virtualAccountNumber}")
@Produces({"application/hal+json"})
@Consumes("application/json")
@LogDuration(limit = 50)
@ApiOperation(value = "Create new or update existing virtualaccount", response = VirtualAccountRepresentation.class,
        authorizations = {
                @Authorization(value = "oauth2", scopes = {}),
                @Authorization(value = "oauth2-cc", scopes = {}),
                @Authorization(value = "oauth2-ac", scopes = {}),
                @Authorization(value = "oauth2-rop", scopes = {}),
                @Authorization(value = "Bearer")
        },
        extensions = {@Extension(name = "roles", properties = {
                @ExtensionProperty(name = "customer", value = "customer allows getting own customer"),
                @ExtensionProperty(name = "system", value = "system allows getting every customer")
        })},
        notes = "PUT is used to create a new virtualaccount or used to alter the values attached to the virtual account",
        consumes = "application/json",
        produces = "application/hal+json, application/hal+json;concept=virtualaccount;v=1, application/hal+json;concept=virtualaccount;v=2",
        nickname = "updateVirtualAccount")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "Could not update or create the virtualaccount", response = ErrorRepresentation.class),
        @ApiResponse(code = 415, message = "The content-Type was not supported"),
        @ApiResponse(code = 201, message = "New VirtualAccount Created", response = VirtualAccountRepresentation.class,
                responseHeaders = {
                        @ResponseHeader(name = "VirtualAccount", description = "a link to the created resource"),
                        @ResponseHeader(name = "Content-Type", description = "a link to the created resource"),
                        @ResponseHeader(name = "X-Log-Token", description = "an ide for reference purposes in logs etc")
                })
        })
public Response createOrUpdate(@Context UriInfo uriInfo, @Context Request request,
                               @PathParam("virtualAccountNumber") String virtualAccountNumber,
                               @ApiParam(value = "account") VirtualAccountUpdateRepresentation account) {
    if (!virtualAccountNumber.equals(account.getVaNumber())) {
        throw new WebApplicationException(Response.Status.BAD_REQUEST);
    }
    Long no;
    try {
        no = Long.parseLong(virtualAccountNumber);
    } catch (NumberFormatException e) {
        throw new WebApplicationException(Response.Status.BAD_REQUEST);
    }


    Optional<VirtualAccount> virtualaccount = archivist.findAccountByAccountNumber(no);
    VirtualAccount ac;
    if (virtualaccount.isPresent()) {
        ac = virtualaccount.get();
        ac.addUnCommitted(new BigDecimal(account.getUnCommittedBalance()));
    } else {
        ac = new VirtualAccount(no, new BigDecimal(account.getTotalBalance()),
                new BigDecimal(account.getCommittedBalance()), new BigDecimal(account.getUnCommittedBalance()));
    }
    archivist.save(ac);

    CacheControl cc = new CacheControl();
    int maxAge = 30;
    cc.setMaxAge(maxAge);

    return Response.created(URI.create(uriInfo.getPath()))
            .entity(new VirtualAccountRepresentation(ac, uriInfo))
            .cacheControl(cc).expires(Date.from(CurrentTime.now().plusSeconds(maxAge)))
            .status(201)
            .type("application/hal+json;concept=virtualaccount;v=2")
            .build();
}