Package org.springframework.http

Examples of org.springframework.http.HttpStatus


        "/tonr2/sparklr/photos/1", headers);
    location = authenticateAndApprove(location);

    assertTrue("Redirect location should be to the original photo URL: "
        + location, location.contains("photos/1"));
    HttpStatus status = serverRunning.getStatusCode(location, headers);
    assertEquals(HttpStatus.OK, status);
  }
View Full Code Here


        "/tonr2/sparklr/trigger", headers);
    location = authenticateAndApprove(location);

    assertTrue("Redirect location should be to the original photo URL: "
        + location, location.contains("sparklr/redirect"));
    HttpStatus status = serverRunning.getStatusCode(location, headers);
    assertEquals(HttpStatus.OK, status);
  }
View Full Code Here

    restTemplate.setAccessTokenProvider(accessTokenProvider);
    request = Mockito.mock(ClientHttpRequest.class);
    headers = new HttpHeaders();
    Mockito.when(request.getHeaders()).thenReturn(headers);
    ClientHttpResponse response = Mockito.mock(ClientHttpResponse.class);
    HttpStatus statusCode = HttpStatus.OK;
    Mockito.when(response.getStatusCode()).thenReturn(statusCode);
    Mockito.when(request.execute()).thenReturn(response);
  }
View Full Code Here

     * @param styleRef                 the uri/file/else for attempting to load a style
     * @param loadFunction             the function to call when data has been loaded.
     */
    public static Optional<Style> loadStyleAsURI(final ClientHttpRequestFactory clientHttpRequestFactory, final String styleRef,
                                                 final Function<byte[], Optional<Style>> loadFunction) throws IOException {
        HttpStatus statusCode;
        final byte[] input;

        Closer closer = Closer.create();
        try {
            URI uri;
View Full Code Here

        protected Tile compute() {
            ClientHttpResponse response = null;
            try {
                LOGGER.debug("\n\t" + this.tileRequest.getMethod() + " -- " + this.tileRequest.getURI());
                response = this.tileRequest.execute();
                final HttpStatus statusCode = response.getStatusCode();
                if (statusCode != HttpStatus.OK) {
                    LOGGER.error("Error making tile request: " + this.tileRequest.getURI() + "\n\tStatus: " + statusCode +
                                 "\n\tMessage: " + response.getStatusText());
                    return new Tile(this.errorImage, getTileIndexX(), getTileIndexY());
                }
View Full Code Here

                    public boolean matches(Object argument) {
                        return true;
                    }
                }), anyString(), anyString()));

        HttpStatus statusCode = isMember ? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND;
        expectedResult.willReturn(new ResponseEntity<>(statusCode));
    }
View Full Code Here

  private String getExceptionMessage(Throwable throwable, Integer statusCode) {
    if (throwable != null) {
      return Throwables.getRootCause(throwable).getMessage();
    }
    HttpStatus httpStatus = HttpStatus.valueOf(statusCode);
    return httpStatus.getReasonPhrase();
  }
View Full Code Here

   * @param response the response to check for a message body
   * @return {@code true} if the response has a body, {@code false} otherwise
   * @throws IOException in case of I/O errors
   */
  protected boolean hasMessageBody(ClientHttpResponse response) throws IOException {
    HttpStatus responseStatus = response.getStatusCode();
    if (responseStatus == HttpStatus.NO_CONTENT ||
        responseStatus == HttpStatus.NOT_MODIFIED) {
      return false;
    }
    long contentLength = response.getHeaders().getContentLength();
View Full Code Here

        addHttpHeaders(request, headers);
        connection.sendRequest(request, createRequestCallback(body, responses, latch));

        latch.await();
        final ClientResponse response = responses.iterator().next();
        HttpStatus status = HttpStatus.valueOf(response.getResponseCode());
        HttpHeaders responseHeaders = toHttpHeaders(response.getResponseHeaders());
        String responseBody = response.getAttachment(RESPONSE_BODY);
        return (responseBody != null ?
            new ResponseEntity<String>(responseBody, responseHeaders, status) :
            new ResponseEntity<String>(responseHeaders, status));
View Full Code Here

          @Override
          public void completed(final ClientExchange result) {

            ClientResponse response = result.getResponse();
            if (response.getResponseCode() != 200) {
              HttpStatus status = HttpStatus.valueOf(response.getResponseCode());
              IoUtils.safeClose(result.getConnection());
              onFailure(new HttpServerErrorException(status, "Unexpected XHR receive status"));
            }
            else {
              SockJsResponseListener listener = new SockJsResponseListener(result.getConnection(),
View Full Code Here

TOP

Related Classes of org.springframework.http.HttpStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.