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


Java ApiResponse类代码示例

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


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

示例1: putSubjectConnector

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@ApiOperation(value = "Creates or updates connector configuration for external subject attributes for the given "
        + "zone.", tags = { "Attribute Connector Management" })
@ApiResponses(value = {
        @ApiResponse(code = 201, message = "Connector configuration for the given zone is successfully created.") })
@RequestMapping(method = PUT, value = V1 + AcsApiUriTemplates.SUBJECT_CONNECTOR_URL,
        consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> putSubjectConnector(
        @ApiParam(value = "New or updated connector configuration for external subject attributes",
                required = true) @RequestBody final AttributeConnector connector) {
    try {
        boolean connectorCreated = this.service.upsertSubjectConnector(connector);

        if (connectorCreated) {
            // return 201 with empty response body
            return created(V1 + AcsApiUriTemplates.SUBJECT_CONNECTOR_URL, false);
        }
        // return 200 with empty response body
        return ok();
    } catch (AttributeConnectorException e) {
        throw new RestApiException(HttpStatus.UNPROCESSABLE_ENTITY, e.getMessage(), e);
    }
}
 
开发者ID:eclipse,项目名称:keti,代码行数:23,代码来源:AttributeConnectorController.java

示例2: validate

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@POST
@Path(value = "/validation")
@Consumes("application/json")
@Produces(MediaType.APPLICATION_JSON)
@ApiResponses({//
    @ApiResponse(code = 204, message = "All validations pass"), //
    @ApiResponse(code = 400, message = "Found violations in validation", responseContainer = "Set",
        response = Violation.class)//
})
default Response validate(@NotNull final T obj) {
    final Set<ConstraintViolation<T>> constraintViolations = getValidator().validate(obj, AllValidations.class);

    if (constraintViolations.isEmpty()) {
        return Response.noContent().build();
    }

    throw new ConstraintViolationException(constraintViolations);
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:19,代码来源:Validating.java

示例3: getParticipantFromCGOR

import io.swagger.annotations.ApiResponse; //导入依赖的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

示例4: getCustomerServiceMetadata

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=metadata;v=1"})
@ApiOperation(
        value = "metadata for the events endpoint", response = EventsMetadataRepresentation.class,
        authorizations = {
                @Authorization(value = "oauth2", scopes = {}),
                @Authorization(value = "oauth2-cc", scopes = {}),
                @Authorization(value = "oauth2-ac", scopes = {}),
                @Authorization(value = "oauth2-rop", scopes = {}),
                @Authorization(value = "Bearer")
        },
        notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
                "subscribers to the customer service should be able to listen for and react to. In other words this is the authoritative" +
                "feed for the customer service",
        tags = {"events"},
        produces = "application/hal+json,  application/hal+json;concept=metadata;v=1",
        nickname = "getCustomerMetadata"
    )
@ApiResponses(value = {
        @ApiResponse(code = 415, message = "Content type not supported.")
    })
public Response getCustomerServiceMetadata(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) {
    return eventMetadataProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request);
}
 
开发者ID:psd2-in-a-box,项目名称:mid-tier,代码行数:25,代码来源:CustomerEventFeedMetadataServiceExposure.java

示例5: getMetadata

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=metadata;v=1"})
@ApiOperation(
        value = "metadata for the events endpoint", response = EventsMetadataRepresentation.class,
        authorizations = {
                @Authorization(value = "oauth2", scopes = {}),
                @Authorization(value = "oauth2-cc", scopes = {}),
                @Authorization(value = "oauth2-ac", scopes = {}),
                @Authorization(value = "oauth2-rop", scopes = {}),
                @Authorization(value = "Bearer")
        },
        notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
                "subscribers to the account service should be able to listen for and react to. In other words this is the authoritative" +
                "feed for the account service",
        tags = {"events"},
        produces = "application/hal+json,  application/hal+json;concept=metadata;v=1",
        nickname = "getAccountMetadata"
    )
@ApiResponses(value = {
        @ApiResponse(code = 415, message = "Content type not supported.")
    })
public Response getMetadata(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) {
    return eventMetadataProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request);
}
 
开发者ID:psd2-in-a-box,项目名称:mid-tier,代码行数:25,代码来源:AccountEventFeedMetadataServiceExposure.java

示例6: getResourceConnector

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@ApiOperation(value = "Retrieves connector configuration for external resource attributes for the given zone.",
        tags = { "Attribute Connector Management" }, response = AttributeConnector.class)
@ApiResponses(
        value = { @ApiResponse(code = 404, message = "Connector configuration for the given zone is not found.") })
@RequestMapping(method = GET, value = V1 + AcsApiUriTemplates.RESOURCE_CONNECTOR_URL)
public ResponseEntity<AttributeConnector> getResourceConnector() {
    try {
        AttributeConnector connector = this.service.retrieveResourceConnector();
        if (connector != null) {
            return ok(obfuscateAdapterSecret(connector));
        }
        return notFound();
    } catch (AttributeConnectorException e) {
        throw new RestApiException(HttpStatus.UNPROCESSABLE_ENTITY, e);
    }
}
 
开发者ID:eclipse,项目名称:keti,代码行数:17,代码来源:AttributeConnectorController.java

示例7: install

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@PUT
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Install Presto using rpm or tarball")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response install(String urlToFetchPackage,
        @QueryParam("checkDependencies") @DefaultValue("true") boolean checkDependencies,
        @QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester.Builder apiRequester = requesterBuilder(ControllerPackageAPI.class)
            .httpMethod(PUT)
            .accept(MediaType.TEXT_PLAIN)
            .entity(Entity.entity(urlToFetchPackage, MediaType.TEXT_PLAIN));

    optionalQueryParam(apiRequester, "checkDependencies", checkDependencies);

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

示例8: changedSince

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@RequestMapping(path = "/changedSince",
        method = RequestMethod.POST,
        produces = MediaType.APPLICATION_JSON_VALUE,
        consumes = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "This operation gets the list of changes from remote collection.")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "Invalid request", response = DataGateError.class),
        @ApiResponse(code = 401, message = "Request is not authorized", response = DataGateError.class),
        @ApiResponse(code = 500, message = "Error processing request", response = DataGateError.class),
})
public ChangeFeed changedSince(
        @PathVariable
        @ApiParam("Name of the remote collection.")
                String collection,
        @RequestBody
        @ApiParam("Options for change feed")
                FeedOptions feedOptions) {

    log.debug("Validating changedSince request for " + collection);
    dataGateService.validateRequest(collection);
    ChangeFeed feed = dataGateService.changedSince(collection, feedOptions);
    log.debug(collection + " changed since " + feedOptions.getFromSequence() + " : " + feed);
    return feed;
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:25,代码来源:SyncController.java

示例9: getApplianceManagerConnector

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@ApiOperation(value = "Retrieves the Manager Connector by Id",
        notes = "Password/API Key information is not returned as it is sensitive information",
        response = ApplianceManagerConnectorDto.class)
@Path("/{applianceManagerConnectorId}")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@GET
public ApplianceManagerConnectorDto getApplianceManagerConnector(@Context HttpHeaders headers,
                                                                 @ApiParam(value = "Id of the Appliance Manager Connector",
                                                                         required = true) @PathParam("applianceManagerConnectorId") Long amcId) {

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

    GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest();
    getDtoRequest.setEntityId(amcId);
    getDtoRequest.setEntityName("ApplianceManagerConnector");
    GetDtoFromEntityServiceApi<ApplianceManagerConnectorDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(ApplianceManagerConnectorDto.class);
    return this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto();
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:21,代码来源:ManagerConnectorApis.java

示例10: addDossierFileByDossierId

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@POST
@Path("/{id}/files")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "addDossierFileByDossierId)", response = DossierFileModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierFileModel was updated", response = DossierFileResultsModel.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 addDossierFileByDossierId(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "Attachment files", required = true) @Multipart("file") Attachment file,
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") String id,
		@ApiParam(value = "Metadata of DossierFile", required = true) @Multipart("referenceUid") String referenceUid,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("dossierTemplateNo") String dossierTemplateNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("dossierPartNo") String dossierPartNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("fileTemplateNo") String fileTemplateNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("displayName") String displayName,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("fileType") String fileType,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("isSync") String isSync,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("formData") @Nullable String formData);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:DossierFileManagement.java

示例11: getStatus

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@ApiOperation(value = "Get server status",
        notes = "Returns server status information",
        response = ServerStatusResponse.class)
@ApiResponses(value = {@ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class)})
@Path("/status")
@GET
public Response getStatus() {

    ServerStatusResponse serverStatusResponse = new ServerStatusResponse();
    serverStatusResponse.setVersion(this.server.getVersionStr());
    serverStatusResponse.setDbVersion(DBConnectionManagerApi.TARGET_DB_VERSION);
    serverStatusResponse.setCurrentServerTime(new Date());
    serverStatusResponse.setPid(this.server.getCurrentPid());

    return Response.status(Status.OK).entity(serverStatusResponse).build();
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:18,代码来源:ServerMgmtApis.java

示例12: getSecurityGroupInterface

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@ApiOperation(value = "Retrieves the Traffic Policy Mapping",
        notes = "Retrieves a Traffic Policy Mappings specified by its owning Virtual System and Traffic Policy Mapping Id",
        response = SecurityGroupInterfaceDto.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{vsId}/securityGroupInterfaces/{sgiId}")
@GET
public SecurityGroupInterfaceDto getSecurityGroupInterface(@Context HttpHeaders headers,
        @ApiParam(value = "The Virtual System Id") @PathParam("vsId") Long vsId,
        @ApiParam(value = "The Traffic Policy Mapping Id") @PathParam("sgiId") Long sgiId) {
    logger.info("Getting Security Group Interface " + sgiId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest();
    getDtoRequest.setEntityId(sgiId);
    getDtoRequest.setEntityName("SecurityGroupInterface");
    GetDtoFromEntityServiceApi<SecurityGroupInterfaceDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(SecurityGroupInterfaceDto.class);
    SecurityGroupInterfaceDto dto = this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto();

    this.apiUtil.validateParentIdMatches(dto, vsId, "SecurityGroupInterface");

    return dto;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:23,代码来源:VirtualSystemApis.java

示例13: hasILXP

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@GET
@Path("/has/{repo}/{bucket}/{id}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Check if the LXP object with the given id exists")
@ApiResponses(value = {
        @ApiResponse(code = HTTPStatus.OK, message = "The LXP handle"),
        @ApiResponse(code = HTTPStatus.NOT_FOUND, message = "The LXP requested does not exists"),
        @ApiResponse(code = HTTPStatus.INTERNAL_SERVER, message = "LXP Not Found")
})
public Response hasILXP(@PathParam("repo") final String repo, @PathParam("bucket") final String buck, @PathParam("id") final String id) {

    try {
        boolean exists = exists(repo, buck, id);

        if (exists) {
            String objectHandle = objectHandle(repo, buck, id);
            return HTTPResponses.FOUND(objectHandle);
        } else {
            return HTTPResponses.NOT_FOUND();
        }

    } catch (RepositoryException e) {
        return HTTPResponses.INTERNAL_SERVER();
    }

}
 
开发者ID:stacs-srg,项目名称:storr,代码行数:27,代码来源:Storr.java

示例14: getOrganisationInvitations

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@ApiOperation(value = "getOrganisationInvitations", nickname = "getOrganisationInvitations")
@RequestMapping(value = "/CISConnector/getOrganisationInvitations/{organisation}", method = RequestMethod.GET)
@ApiImplicitParams({
       @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "path")
     })
@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<CgorInvitation>> getOrganisationInvitations(@PathVariable String organisation) throws CISCommunicationException {
	log.info("--> getOrganisationInvitations");
	List<CgorInvitation> cgorInvitationList = new ArrayList<CgorInvitation>();
	
	try {
		cgorInvitationList = connector.getOrganisationInvitations(organisation);
	} catch (CISCommunicationException e) {
		log.error("Error executing the request: Communication Error" , e);
		cgorInvitationList = null;
	}

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

示例15: delete

import io.swagger.annotations.ApiResponse; //导入依赖的package包/类
@DELETE
@Path("{resourceRef}")
@ApiOperation(value = "Deletes an existing resource by ID")
@ApiResponses({
    @ApiResponse(code = 200, message = "Successful operation"),
    @ApiResponse(code = 400, message = "Invalid ID supplied",
        response = ExceptionPresentation.class),
    @ApiResponse(code = 404, message = "Router not found",
        response = ExceptionPresentation.class)})
public void delete(@PathParam("resourceRef") String resourceRef)
    throws CommsRouterException {

  RouterObjectRef routerObjectRef = getRouterObjectRef(resourceRef);

  LOGGER.debug("Deleting {}", routerObjectRef);

  getService().delete(routerObjectRef);
}
 
开发者ID:Nexmo,项目名称:comms-router,代码行数:19,代码来源:GenericRouterObjectResource.java


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