Example usage for org.springframework.http.client ClientHttpResponse getStatusCode

List of usage examples for org.springframework.http.client ClientHttpResponse getStatusCode

Introduction

In this page you can find the example usage for org.springframework.http.client ClientHttpResponse getStatusCode.

Prototype

HttpStatus getStatusCode() throws IOException;

Source Link

Document

Return the HTTP status code as an HttpStatus enum value.

Usage

From source file:org.obiba.onyx.core.service.impl.RestfulParticipantRegistryErrorHandler.java

@Override
public void handleError(ClientHttpResponse response) throws IOException {
    if (response.getStatusCode().equals(HttpStatus.NOT_FOUND)) {
        throw new NoSuchParticipantException(response.getStatusText());
    }/*ww w.j a  v  a2s  .co m*/
    throw new ParticipantRegistryLookupException(response.getStatusText());
}

From source file:com.sra.biotech.submittool.persistence.client.SubmitResponseErrorHandler.java

@Override
public boolean hasError(ClientHttpResponse response) throws IOException {
    return RestUtil.isError(response.getStatusCode());
}

From source file:com.design.perpetual.ecobeethermostat.app.handlers.TemplateErrorHandler.java

@Override
public boolean hasError(ClientHttpResponse chr) throws IOException {
    return ErrorCode.hasError(chr.getStatusCode());
}

From source file:org.zalando.riptide.SeriesSelector.java

@Override
public Optional<HttpStatus.Series> attributeOf(final ClientHttpResponse response) throws IOException {
    return Optional.of(response.getStatusCode().series());
}

From source file:org.zalando.riptide.StatusSelector.java

@Override
public Optional<HttpStatus> attributeOf(final ClientHttpResponse response) throws IOException {
    return Optional.of(response.getStatusCode());
}

From source file:com.design.perpetual.ecobeethermostat.app.handlers.TemplateErrorHandler.java

@Override
public void handleError(ClientHttpResponse chr) throws IOException {
    log.error("Response error: {} {}", chr.getStatusCode(), chr.getStatusText());
}

From source file:com.sra.biotech.submittool.persistence.client.SubmitResponseErrorHandler.java

@Override
public void handleError(ClientHttpResponse response) throws IOException {
    log.error("Response error: {} {}", response.getStatusCode(), response.getStatusText());
}

From source file:cz.cvut.zuul.support.spring.provider.TokenValidationErrorHandler.java

public void handleError(ClientHttpResponse response) throws IOException {
    switch (response.getStatusCode()) {
    case CONFLICT:
        throw new InvalidClientTokenException(response.getStatusText());
    default://from ww  w.  ja va2s .c o  m
        parentHandler.handleError(response);
    }
}

From source file:com.playhaven.android.req.ServerErrorHandler.java

/**
 * <p>The default implementation throws a {@link org.springframework.web.client.HttpClientErrorException} if the response status code is
 * {@link org.springframework.http.HttpStatus.Series#CLIENT_ERROR}, a {@link org.springframework.web.client.HttpServerErrorException}
 * if it is {@link org.springframework.http.HttpStatus.Series#SERVER_ERROR},
 * and a {@link org.springframework.web.client.RestClientException} in other cases.
 *//*from w  w w .  j  a v  a 2  s  . c om*/
@Override
public void handleError(ClientHttpResponse response) throws IOException {
    switch (response.getStatusCode()) {
    case BAD_REQUEST:
        throw new PlayHavenException(getResponseAsString(response));
    default:
        super.handleError(response);
    }
}

From source file:nu.yona.server.rest.RestClientErrorHandler.java

private HttpStatus getStatusCode(ClientHttpResponse response) {
    try {//from w ww. j av a  2 s .com
        return response.getStatusCode();
    } catch (IOException e) {
        throw YonaException.unexpected(e);
    }
}