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


Java HttpStatus.OK_200属性代码示例

本文整理汇总了Java中org.eclipse.jetty.http.HttpStatus.OK_200属性的典型用法代码示例。如果您正苦于以下问题:Java HttpStatus.OK_200属性的具体用法?Java HttpStatus.OK_200怎么用?Java HttpStatus.OK_200使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jetty.http.HttpStatus的用法示例。


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

示例1: parseSendirResponse

private void parseSendirResponse(final ContentResponse response) {

        final String responseContent = response.getContentAsString();

        if ((responseContent == null) || responseContent.isEmpty()) {
            throw new CommunicationException("Empty response received!");
        }

        if (responseContent.startsWith(SENDIR_SUCCESS)) {
            return;
        }

        if (responseContent.startsWith(SENDIR_BUSY)) {
            throw new DeviceBusyException("Device is busy!");
        }

        if ((response.getStatus() != HttpStatus.OK_200) || responseContent.startsWith(SENDIR_ERROR)) {
            throw new CommunicationException(String.format("Failed to send IR code: %s", responseContent));
        }
    }
 
开发者ID:alexmaret,项目名称:openhab-binding-zmote,代码行数:20,代码来源:ZMoteV2Client.java

示例2: rawRequest

protected String rawRequest(String url, Map<String, String> params) throws InterruptedException, ExecutionException, TimeoutException, UnsupportedEncodingException {
    Request req = httpClient.newRequest(new String(url.getBytes("UTF-8"), "UTF-8"))
            .header(HttpHeader.CONTENT_ENCODING, "UTF-8")
            .method(HttpMethod.GET)
            .header(HttpHeader.ACCEPT_ENCODING, "UTF-8");
    req = req.param("app_token", APIKeys.getAPPKey());
    if (params != null) {
        for (String key : params.keySet()) {
            req = req.param(key, params.get(key));
        }
    }
    Main.log.info("GET {}, {}, {}", req, req.getQuery(), req.getParams());
    ContentResponse resp = req.send();
    if (resp.getStatus() != HttpStatus.OK_200) {
        throw new HttpRequestException(
                "Request ended with non-OK status: "
                + HttpStatus.getMessage(resp.getStatus()),
                resp.getRequest()
        );
    }
    return resp.getContentAsString();
}
 
开发者ID:psyriccio,项目名称:VoteFlow,代码行数:22,代码来源:LawAPI.java

示例3: getRun

@GET
@Path("/{runId}")
@UnitOfWork
@ApiOperation(value = "Get a specific run")
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = RunApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
        @ApiResponse(
                code = HttpStatus.CONFLICT_409,
                response = ErrorMessage.class,
                message = "Event ID and Run ID are mismatched"
        )
})
public RunApiEntity getRun(
        @PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
        @PathParam("runId") @ApiParam(value = "Run ID", required = true) String runId
) throws EntityMismatchException, EntityNotFoundException {
    Run domainRun = runEntityService.getByEventIdAndRunId(eventId, runId);
    return runMapper.toApiEntity(domainRun);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:20,代码来源:EventRunsResource.java

示例4: getRegistration

@GET
@Path("/{registrationId}")
@UnitOfWork
@ApiOperation(value = "Get a specific registration")
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = RegistrationApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
        @ApiResponse(
                code = HttpStatus.CONFLICT_409,
                response = ErrorMessage.class,
                message = "Event ID and Registration ID are mismatched"
        )
})
public RegistrationApiEntity getRegistration(
        @PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
        @PathParam("registrationId") @ApiParam(value = "Registration ID", required = true) String registrationId
) throws EntityMismatchException, EntityNotFoundException {
    Registration domainRegistration = eventRegistrationService.getByEventIdAndRegistrationId(
            eventId,
            registrationId
    );
    return registrationMapper.toApiEntity(domainRegistration);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:23,代码来源:EventRegistrationsResource.java

示例5: addHandicapGroupToHandicapGroupSet

@POST
@Path("/{handicapGroupSetId}/handicapGroups/{handicapGroupId}")
@UnitOfWork
@ApiOperation(value = "Add a Handicap Group to a Handicap Group Set", response = HandicapGroupSetApiEntity.class)
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = HandicapGroupSetApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
})
public HandicapGroupSetApiEntity addHandicapGroupToHandicapGroupSet(
        @PathParam("handicapGroupSetId") @ApiParam(value = "Handicap Group Set ID", required = true)
                String handicapGroupSetId,
        @PathParam("handicapGroupId") @ApiParam(value = "Handicap Group ID", required = true)
                String handicapGroupId
) throws EntityNotFoundException {
    HandicapGroupSet domainSetEntity = handicapGroupSetService.getById(handicapGroupSetId);
    HandicapGroup domainEntity = handicapGroupEntityService.getById(handicapGroupId);
    handicapGroupSetService.addToHandicapGroups(domainSetEntity, domainEntity);
    return handicapGroupSetMapper.toApiEntity(domainSetEntity);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:19,代码来源:HandicapGroupSetsResource.java

示例6: addCompetitionGroupToCompetitionGroupSet

@POST
@Path("/{competitionGroupSetId}/competitionGroups/{competitionGroupId}")
@UnitOfWork
@ApiOperation(
        value = "Add a Competition Group to a Competition Group Set",
        response = CompetitionGroupSetApiEntity.class
)
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = CompetitionGroupSetApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
})
public CompetitionGroupSetApiEntity addCompetitionGroupToCompetitionGroupSet(
        @PathParam("competitionGroupSetId") @ApiParam(value = "Competition Group Set ID", required = true)
                String competitionGroupSetId,
        @PathParam("competitionGroupId") @ApiParam(value = "Competition Group ID", required = true)
                String competitionGroupId
) throws EntityNotFoundException {
    CompetitionGroupSet domainSetEntity = competitionGroupSetService.getById(competitionGroupSetId);
    CompetitionGroup domainEntity = competitionGroupEntityService.getById(competitionGroupId);
    competitionGroupSetService.addToCompetitionGroups(domainSetEntity, domainEntity);
    return competitionGroupSetMapper.toApiEntity(domainSetEntity);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:22,代码来源:CompetitionGroupSetsResource.java

示例7: recycle

protected void recycle()
{
    _status = HttpStatus.OK_200;
    _reason = null;
    _locale = null;
    _mimeType = null;
    _characterEncoding = null;
    _contentType = null;
    _outputType = OutputType.NONE;
    _contentLength = -1;
    _out.recycle();
    _fields.clear();
    _explicitEncoding=false;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:14,代码来源:Response.java

示例8: getCACertificate

@Override
public String getCACertificate() {

    ContentResponse response = null;
    try {
        response = httpClient.GET(x509CertUri);
    } catch (InterruptedException | ExecutionException | TimeoutException e) {
        LOGGER.error("getCACertificate: unable to fetch requested uri '" + x509CertUri + "': "
                + e.getMessage());
        return null;
    }
    if (response.getStatus() != HttpStatus.OK_200) {
        LOGGER.error("getCACertificate: unable to fetch requested uri '" + x509CertUri +
                "' status: " + response.getStatus());
        return null;
    }

    String data = response.getContentAsString();
    if (data == null || data.isEmpty()) {
        LOGGER.error("getCACertificate: received empty response from uri '" + x509CertUri +
                "' status: " + response.getStatus());
        return null;
    }

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("getCACertificate: CA Certificate" + data);
    }

    X509CertSignObject pemCert = null;
    try {
        pemCert = JSON.fromString(data, X509CertSignObject.class);
    } catch (Exception ex) {
        LOGGER.error("getCACertificate: unable to decode object from '" + x509CertUri +
                "' error: " + ex.getMessage());
    }
    return (pemCert != null) ? pemCert.getPem() : null;
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:37,代码来源:HttpCertSigner.java

示例9: getCompetitionGroup

@GET
@Path("/{competitionGroupId}")
@UnitOfWork
@ApiOperation(value = "Get a Competition Group", response = CompetitionGroupApiEntity.class)
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = CompetitionGroupApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public CompetitionGroupApiEntity getCompetitionGroup(
        @PathParam("competitionGroupId") @ApiParam(value = "Competition Group ID", required = true) String id
) throws EntityNotFoundException {
    CompetitionGroup domainEntity = competitionGroupEntityService.getById(id);
    return competitionGroupMapper.toApiEntity(domainEntity);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:14,代码来源:CompetitionGroupsResource.java

示例10: getEvent

@GET
@Path("/{eventId}")
@UnitOfWork
@ApiOperation(value = "Get an Event")
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = EventApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public EventApiEntity getEvent(
        @PathParam("eventId") @ApiParam(value = "Event ID", required = true) String id
) throws EntityNotFoundException {
    Event domainEntity = eventEntityService.getById(id);
    return eventMapper.toApiEntity(domainEntity);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:14,代码来源:EventsResource.java

示例11: getHandicapGroupSet

@GET
@Path("/{handicapGroupSetId}")
@UnitOfWork
@ApiOperation(value = "Get a Handicap Group Set", response = HandicapGroupSetApiEntity.class)
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = HandicapGroupSetApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public HandicapGroupSetApiEntity getHandicapGroupSet(
        @PathParam("handicapGroupSetId")
        @ApiParam(value = "Handicap Group Set ID", required = true) String id
) throws EntityNotFoundException {
    HandicapGroupSet domainEntity = handicapGroupSetService.getById(id);
    return handicapGroupSetMapper.toApiEntity(domainEntity);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:15,代码来源:HandicapGroupSetsResource.java

示例12: getCompetitionGroupSet

@GET
@Path("/{competitionGroupSetId}")
@UnitOfWork
@ApiOperation(value = "Get a Competition Group Set", response = CompetitionGroupSetApiEntity.class)
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = CompetitionGroupSetApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public CompetitionGroupSetApiEntity getCompetitionGroupSet(
        @PathParam("competitionGroupSetId")
        @ApiParam(value = "Competition Group Set ID", required = true) String id
) throws EntityNotFoundException {
    CompetitionGroupSet domainEntity = competitionGroupSetService.getById(id);
    return competitionGroupSetMapper.toApiEntity(domainEntity);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:15,代码来源:CompetitionGroupSetsResource.java

示例13: getHandicapGroup

@GET
@Path("/{handicapGroupId}")
@UnitOfWork
@ApiOperation(value = "Get a Handicap Group", response = HandicapGroupApiEntity.class)
@ApiResponses({
        @ApiResponse(code = HttpStatus.OK_200, response = HandicapGroupApiEntity.class, message = "OK"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public HandicapGroupApiEntity getHandicapGroup(
        @PathParam("handicapGroupId") @ApiParam(value = "Handicap Group ID", required = true) String id
) throws EntityNotFoundException {
    HandicapGroup domainEntity = handicapGroupEntityService.getById(id);
    return handicapGroupMapper.toApiEntity(domainEntity);
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:14,代码来源:HandicapGroupsResource.java

示例14: isAuthorised

@Override
public boolean isAuthorised(final ServiceUser serviceUser,
                            final DocRef docRef,
                            final String permissionName) {
    Response response;
    try {
        final Map<String, Object> request = new HashMap<>();
        request.put("docRef", new DocRef.Builder()
                .uuid(docRef.getUuid())
                .type(docRef.getType())
                .build()); // stripping out the name
        request.put("permission", permissionName);

        response = httpClient
                .target(this.isAuthorisedUrl)
                .request()
                .header("Authorization", "Bearer " + serviceUser.getJwt())
                .post(Entity.json(request));
    } catch (final Exception e) {
        LOGGER.error("Could not request authorisation " + e.getLocalizedMessage());
        return false;
    }

    boolean isUserAuthorised;

    switch (response.getStatus()) {
        case HttpStatus.UNAUTHORIZED_401:
            isUserAuthorised = false;
            break;
        case HttpStatus.OK_200:
            isUserAuthorised = true;
            break;
        case HttpStatus.NOT_FOUND_404:
            isUserAuthorised = false;
            LOGGER.error("Received a 404 when trying to access the authorisation service! I am unable to check authorisation so all requests will be rejected until this is fixed. Is the service location correctly configured? Is the service running? The URL I tried was: {}", this.isAuthorisedUrl);
            break;
        default:
            isUserAuthorised = false;
            LOGGER.error("Tried to check authorisation for a user but got an unknown response!",
                    response.getStatus());
    }

    return isUserAuthorised;
}
 
开发者ID:gchq,项目名称:stroom-query,代码行数:44,代码来源:AuthorisationServiceImpl.java

示例15: getSSHCertificate

@Override
public String getSSHCertificate(String type) {

    ContentResponse response = null;
    try {
        response = httpClient.GET(sshCertUri);
    } catch (InterruptedException | ExecutionException | TimeoutException e) {
        LOGGER.error("getSSHCertificate: unable to fetch requested uri '" + sshCertUri + "': "
                + e.getMessage());
        return null;
    }
    if (response.getStatus() != HttpStatus.OK_200) {
        LOGGER.error("getSSHCertificate: unable to fetch requested uri '" + sshCertUri +
                "' status: " + response.getStatus());
        return null;
    }

    String data = response.getContentAsString();
    if (data == null || data.isEmpty()) {
        LOGGER.error("getSSHCertificate: received empty response from uri '" + sshCertUri +
                "' status: " + response.getStatus());
        return null;
    }

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("getSSHCertificate: SSH Certificate" + data);
    }

    SSHCertificates sshCerts = null;
    try {
        sshCerts = JSON.fromString(data, SSHCertificates.class);
    } catch (Exception ex) {
        LOGGER.error("getSSHCertificate: unable to decode object from '" + sshCertUri +
                "' error: " + ex.getMessage());
        return null;
    }
    
    if (sshCerts != null && sshCerts.getCerts() != null) {
        for (SSHCertificate sshCert : sshCerts.getCerts()) {
            if (sshCert.getType().equals(type)) {
                return sshCert.getOpensshkey();
            }
        }
    }
    
    return null;
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:47,代码来源:HttpCertSigner.java


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