当前位置: 首页>>代码示例>>Java>>正文


Java ApiResponses类代码示例

本文整理汇总了Java中io.swagger.annotations.ApiResponses的典型用法代码示例。如果您正苦于以下问题:Java ApiResponses类的具体用法?Java ApiResponses怎么用?Java ApiResponses使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ApiResponses类属于io.swagger.annotations包,在下文中一共展示了ApiResponses类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: userAddPost

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@ApiOperation(value = "用户新增", notes = "用户新增", response = ResultDTO.class, tags = { "ZhihuUser", })
@ApiResponses(value = { @ApiResponse(code = 200, message = "返回应用服务器的请求列表", response = ResultDTO.class),
		@ApiResponse(code = 200, message = "返回错误信息", response = ResultDTO.class) })

@RequestMapping(value = "/user/add", produces = { "application/json" }, method = RequestMethod.POST)
public ResponseEntity<ResultDTO> userAddPost(
		@NotNull @ApiParam(value = "用户名", required = false, defaultValue = "夕阳晚晴") @RequestParam(value = "username", required = false) String username,
		@NotNull @ApiParam(value = "user token", required = false, defaultValue = "xi-yang-wan-qing-30") @RequestParam(value = "userToken", required = false) String userToken,
		@NotNull @ApiParam(value = "位置", required = false) @RequestParam(value = "location", required = false) String location,
		@NotNull @ApiParam(value = "行业", required = false, defaultValue = "互联网") @RequestParam(value = "business", required = false) String business,
		@NotNull @ApiParam(value = "性别", required = false, defaultValue = "male") @RequestParam(value = "sex", required = false) String sex,
		@NotNull @ApiParam(value = "企业", required = false) @RequestParam(value = "employment", required = false) String employment,
		@NotNull @ApiParam(value = "教育", required = false) @RequestParam(value = "education", required = false) String education,
		@NotNull @ApiParam(value = "用户首页url", required = false, defaultValue = "https://www.zhihu.com/people/xi-yang-wan-qing-30/activities") @RequestParam(value = "url", required = false) String url,
		@NotNull @ApiParam(value = "答案赞同数", required = false, defaultValue = "0") @RequestParam(value = "agrees", required = false) Integer agrees,
		@NotNull @ApiParam(value = "感谢数", required = false, defaultValue = "0") @RequestParam(value = "thanks", required = false) Integer thanks,
		@NotNull @ApiParam(value = "提问数", required = false, defaultValue = "0") @RequestParam(value = "asks", required = false) Integer asks,
		@NotNull @ApiParam(value = "回答数", required = false, defaultValue = "0") @RequestParam(value = "answers", required = false) Integer answers,
		@NotNull @ApiParam(value = "文章数", required = false, defaultValue = "0") @RequestParam(value = "posts", required = false) Integer posts,
		@NotNull @ApiParam(value = "关注人数", required = false, defaultValue = "1") @RequestParam(value = "followees", required = false) Integer followees,
		@NotNull @ApiParam(value = "粉丝数量", required = false, defaultValue = "0") @RequestParam(value = "followers", required = false) Integer followers,
		@NotNull @ApiParam(value = "用户唯一标识", required = false, defaultValue = "88fb5d79df5a332cf16c8f8ad659dcf4") @RequestParam(value = "hashId", required = false) String hashId);
 
开发者ID:sdc1234,项目名称:zhihu-spider,代码行数:23,代码来源:UserApi.java

示例2: getAdaptorConfiguration

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@ApiOperation(value = "getAdaptorConfiguration", nickname = "getAdaptorConfiguration")
@RequestMapping(value = "/CISCore/getAdaptorConfiguration", method = RequestMethod.GET)
@ApiResponses(value = { 
           @ApiResponse(code = 200, message = "Success", response = AdaptorConfigurationImpl.class),
           @ApiResponse(code = 400, message = "Bad Request", response = AdaptorConfigurationImpl.class),
           @ApiResponse(code = 500, message = "Failure", response = AdaptorConfigurationImpl.class)}) 
public ResponseEntity<AdaptorConfigurationImpl> getAdaptorConfiguration() {
	log.info("--> getAdaptorConfiguration");
	
	AdaptorConfigurationImpl config = (AdaptorConfigurationImpl)cisCore.getAdaptorConfiguration();
	
	HttpHeaders responseHeaders = new HttpHeaders();
	
	log.info("getAdaptorConfiguration -->");
	return new ResponseEntity<AdaptorConfigurationImpl>(config, responseHeaders, HttpStatus.OK);
}
 
开发者ID:DRIVER-EU,项目名称:CommonInformationSpace,代码行数:17,代码来源:CISCoreConnectorRestController.java

示例3: list

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=virtualaccount;v=1"})
@ApiOperation(value = "lists accounts", response = VirtualAccountsRepresentation.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 = "advisor", value = "advisors are allowed getting every virtualaccount"),
                @ExtensionProperty(name = "customer", value = "customer only allowed getting own locations")}
        )},
        produces = "application/hal+json, application/hal+json;concept=locations;v=1",
        notes = "List all locations in a default projection, which is VirtualAccount version 1" +
                "Supported projections and versions are: " +
                "VirtualAccounts in version 1 " +
                "The Accept header for the default version is application/hal+json;concept=virtualaccount;v=1.0.0.... " +
                "The format for the default version is {....}", nickname = "listVirtualAccounts")
@ApiResponses(value = {
        @ApiResponse(code = 415, message = "Content type not supported.")
    })
public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) {
    return accountsProducer.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request);
}
 
开发者ID:psd2-in-a-box,项目名称:mid-tier,代码行数:27,代码来源:VirtualAccountServiceExposure.java

示例4: getApplicantDetail

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get a detail applicant", response = ApplicantModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a applicant", response = ApplicantModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response getApplicantDetail(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:14,代码来源:ApplicantManagement.java

示例5: endpoint

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@ApiOperation(
        value = "Updates an Manager Connector.  If we are unable to connect to the endpoint(IP) using the credentials provided, this call will fail.",
        notes = "Creates an Manager Connector and sync's it immediately. "
                + "If we are unable to connect to the manager using the credentials provided, this call will fail."
                + "To skip validation of IP and credentials 'skipRemoteValidation' flag can be used.",
        response = BaseJobResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400,
        message = "In case of any error validating the information",
        response = ErrorCodeDto.class) })
@Path("/{applianceManagerConnectorId}")
@PUT
public Response updateApplianceManagerConnector(@Context HttpHeaders headers,
                                                @ApiParam(value = "Id of the Appliance Manager Connector",
                                                        required = true) @PathParam("applianceManagerConnectorId") Long amcId,
                                                @ApiParam(required = true) ApplianceManagerConnectorRequest amcRequest) {

    logger.info("Updating Appliance Manager Connector " + amcId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));

    this.apiUtil.setIdOrThrow(amcRequest, amcId, "Appliance Manager Connector");

    Response responseForBaseRequest = this.apiUtil.getResponseForBaseRequest(this.updateService,
                new DryRunRequest<>(amcRequest, amcRequest.isSkipRemoteValidation()));
    return responseForBaseRequest;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:26,代码来源:ManagerConnectorApis.java

示例6: getParticipantFromCGOR

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR")
@RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET)
@ApiImplicitParams({
       @ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"),
       @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query")
     })
@ApiResponses(value = { 
           @ApiResponse(code = 200, message = "Success", response = Participant.class),
           @ApiResponse(code = 400, message = "Bad Request", response = Participant.class),
           @ApiResponse(code = 500, message = "Failure", response = Participant.class)})
public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) {
	log.info("--> getParticipantFromCGOR: " + cgorName);
	
	Participant participant;
	
	try {
		participant = connector.getParticipantFromCGOR(cgorName, organisation);
	} catch (CISCommunicationException e) {
		log.error("Error executing the request: Communication Error" , e);
		participant = null;
	}
	
	HttpHeaders responseHeaders = new HttpHeaders();
	
	log.info("getParticipantFromCGOR -->");
	return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK);
}
 
开发者ID:DRIVER-EU,项目名称:CommonInformationSpace,代码行数:28,代码来源:CISAdaptorConnectorRestController.java

示例7: validate

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
/**
 * Validate logins yml.
 * @param loginsYml logins yml
 * @return true if valid
 */
@PostMapping(value = "/logins/validate", consumes = {TEXT_PLAIN_VALUE})
@ApiOperation(value = "Validate uaa login properties format", response = UaaValidationVM.class)
@ApiResponses(value = {
    @ApiResponse(code = 200, message = "Uaa validation result", response = UaaValidationVM.class),
    @ApiResponse(code = 500, message = "Internal server error")})
@SneakyThrows
@Timed
public UaaValidationVM validate(@RequestBody String loginsYml) {
    try {
        mapper.readValue(loginsYml, TenantLogins.class);
        return UaaValidationVM.builder().isValid(true).build();
    } catch (JsonParseException | JsonMappingException e) {
        return UaaValidationVM.builder().isValid(false).errorMessage(e.getLocalizedMessage()).build();
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:21,代码来源:TenantLoginsResource.java

示例8: createFlow

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Creates a flow",
        notes = "The flow id is created by the server and populated in the returned entity.",
        response = VersionedFlow.class
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response createFlow(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
        final String bucketId, final VersionedFlow flow) {

    authorizeBucketAccess(RequestAction.WRITE, bucketId);
    verifyPathParamsMatchBody(bucketId, flow);
    final VersionedFlow createdFlow = registryService.createFlow(bucketId, flow);
    permissionsService.populateItemPermissions(createdFlow);
    linkService.populateFlowLinks(createdFlow);
    return Response.status(Response.Status.OK).entity(createdFlow).build();
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:27,代码来源:BucketFlowResource.java

示例9: authenticate

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@POST
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Authenticate a user", notes = "Verify a user credentials")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "user authenticated"),
        @ApiResponse(code = 401, message = "Wrong user or password")})
public Response authenticate(Credentials credentials) {
    if (UsersDao.authenticate(credentials)) {
        byte[] bearer = UsersDao.getBearer(credentials);
        StringBuilder auth = new StringBuilder().append("Bearer ").append(PasswordStorage.toBase64(bearer));
        return Response.ok()
                .cookie(new NewCookie("Authorization", auth.toString(), null, null,
                        DEFAULT_VERSION, null, DEFAULT_MAX_AGE, null, true, true))
                .entity(new ResponseMessage(true, "user authenticated")).build();
    } else {
        return Response.status(UNAUTHORIZED)
                .entity(new ResponseMessage(false, "Username or password is incorrect")).build();
    }

}
 
开发者ID:javathought,项目名称:devoxx-2017,代码行数:22,代码来源:AuthenticateResource.java

示例10: getById

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@GET
@Produces({APPLICATION_JSON, APPLICATION_XML})
@Path("/{id : \\d+}")
@ApiOperation(value = "Get user by id", notes = "Returns user identified by is internal id")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "OK"),
        @ApiResponse(code = 404, message = "User not found"),
        @ApiResponse(code = 500, message = "Something wrong in Server")})
public Response getById(@PathParam("id") long id) {

    Optional<User> userOptional = UsersDao.getById(id);

    if (userOptional.isPresent()) {
        return Response.ok().entity(userOptional.get()).build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
 
开发者ID:javathought,项目名称:devoxx-2017,代码行数:19,代码来源:UsersResource.java

示例11: createSecurityGroup

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@ApiOperation(value = "Creates a Security Group",
        notes = "Creates a Security Group owned by Virtualization Connector provided and kicks off a " + "sync job",
        response = BaseJobResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{vcId}/securityGroups")
@POST
public Response createSecurityGroup(@Context HttpHeaders headers,
        @ApiParam(value = "The Virtualization Connector Id") @PathParam("vcId") Long vcId,
        @ApiParam(required = true) SecurityGroupDto sgDto) {
    logger.info("Creating Security Group ...");
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    this.apiUtil.setIdAndParentIdOrThrow(sgDto, null, vcId, "Security Group");
    AddOrUpdateSecurityGroupRequest request = new AddOrUpdateSecurityGroupRequest();
    request.setDto(sgDto);
    return this.apiUtil.getResponseForBaseRequest(this.addSecurityGroupService, request);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:18,代码来源:VirtualizationConnectorApis.java

示例12: getSpeaker

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@ApiOperation(
        value = "Find speaker by ID",
        notes = "For valid response try integer IDs with value 1 ... 999. Other values will generated exceptions",
        response = SpeakerResource.class)
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Successful retrieve the speaker.", response = SpeakerResource.class),
        @ApiResponse(code = 400, message = "Invalid ID supplied"),
        @ApiResponse(code = 404, message = "Speaker not found"),
        @ApiResponse(code = 500, message = "Internal server error.")})
@GetMapping(value = "/{id}")
public ResponseEntity<SpeakerResource> getSpeaker(
        @ApiParam(value = "ID of speaker that needs to be fetched",
                allowableValues = "range[1,999]",
                required = true)
        @PathVariable long id) {
    return speakerRepository.findOne(id)
            .map(speaker -> ResponseEntity.ok(new SpeakerResource(speaker)))
            .orElse(new ResponseEntity(HttpStatus.NOT_FOUND));
}
 
开发者ID:tsypuk,项目名称:springrestdoc,代码行数:20,代码来源:SpeakerController.java

示例13: getConfig

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@GET
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Get list of all available configuration files")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response getConfig(@QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester apiRequester = requesterBuilder(ControllerConfigAPI.class)
            .httpMethod(GET)
            .accept(MediaType.TEXT_PLAIN)
            .build();

    return forwardRequest(scope, apiRequester, nodeId);
}
 
开发者ID:prestodb,项目名称:presto-manager,代码行数:17,代码来源:ControllerConfigAPI.java

示例14: countCustomer

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@GET
@Path("/countCustomers")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get the Customer Resource.",produces=MediaType.APPLICATION_JSON, response = Long.class)
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "CustomerCount Resource is found"),
        @ApiResponse(code = 404, message = "CustomerCount Resource cannot be found")

})
public long countCustomer() {
    try {
      return  customerService.count();
    } catch (Exception e) {
        e.printStackTrace();
        return  -1;
    }
}
 
开发者ID:WillemJiang,项目名称:acmeair,代码行数:18,代码来源:CustomerConfiguration.java

示例15: getOrganisationList

import io.swagger.annotations.ApiResponses; //导入依赖的package包/类
@ApiOperation(value = "getOrganisationList", nickname = "getOrganisationList")
@RequestMapping(value = "/CISCore/getOrganisationList", method = RequestMethod.GET)
@ApiResponses(value = { 
           @ApiResponse(code = 200, message = "Success", response = ResponseEntity.class),
           @ApiResponse(code = 400, message = "Bad Request", response = ResponseEntity.class),
           @ApiResponse(code = 500, message = "Failure", response = ResponseEntity.class)})
public ResponseEntity<List<Organisation>> getOrganisationList() throws CISCommunicationException {
	log.info("--> getOrganisationList");
	List<Organisation> organisationList = new ArrayList<Organisation>();
	
	try {
		organisationList = cisCore.getOrganisationList();
	} catch (CISCommunicationException e) {
		log.error("Error executing the request: Communication Error" , e);
		organisationList = null;
	}

	HttpHeaders responseHeaders = new HttpHeaders();
	
	log.info("getOrganisationList -->");
	return new ResponseEntity<List<Organisation>>(organisationList, responseHeaders, HttpStatus.OK);
}
 
开发者ID:DRIVER-EU,项目名称:CommonInformationSpace,代码行数:23,代码来源:CISCoreConnectorRestController.java


注:本文中的io.swagger.annotations.ApiResponses类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。