org.springframework.web.client.HttpClientErrorException: 400 Bad Request

Spring JIRA | Glenn Li | 5 years ago
  1. 0

    Used RestTemplate to access this URL: http://query.yahooapis.com/v1/public/yql?q=select Date, Close, Volume from yahoo.finance.historicaldata where symbol = "AAPL" and startDate = "2012-01-01" and endDate = "2012-01-10"&format=json&env=store://datatables.org/alltableswithkeys Getting this on Android: 400 Bad Request org.springframework.web.client.HttpClientErrorException: 400 Bad Request at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:504) Tried UriUtils.encodeHttpUrl, and noticed '=' got encoded as '&' at symbol = "AAPL", and not sure if that's the cause of the above issue: http://query.yahooapis.com/v1/public/yql?q=select%20Date,%20Close,%20Volume%20from%20yahoo.finance.historicaldata%20where%20symbol%20&%20%22AAPL%22%20and%20startDate%20=%20%222012-01-01%22%20and%20endDate%20&%20%222012-01-10%22&format=json&env=store://datatables.org/alltableswithkeys For comparison, correctly encoded URL should be: http://query.yahooapis.com/v1/public/yql?q=select%20Date,%20Close,%20Volume%20from%20yahoo.finance.historicaldata%20where%20symbol%20=%20%22AAPL%22%20and%20startDate%20=%20%222012-01-01%22%20and%20endDate%20=%20%222012-01-10%22&format=json&env=store://datatables.org/alltableswithkeys When tried same code on desktop, and it worked fine there.

    Spring JIRA | 5 years ago | Glenn Li
    org.springframework.web.client.HttpClientErrorException: 400 Bad Request
  2. 0

    Used RestTemplate to access this URL: http://query.yahooapis.com/v1/public/yql?q=select Date, Close, Volume from yahoo.finance.historicaldata where symbol = "AAPL" and startDate = "2012-01-01" and endDate = "2012-01-10"&format=json&env=store://datatables.org/alltableswithkeys Getting this on Android: 400 Bad Request org.springframework.web.client.HttpClientErrorException: 400 Bad Request at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:504) Tried UriUtils.encodeHttpUrl, and noticed '=' got encoded as '&' at symbol = "AAPL", and not sure if that's the cause of the above issue: http://query.yahooapis.com/v1/public/yql?q=select%20Date,%20Close,%20Volume%20from%20yahoo.finance.historicaldata%20where%20symbol%20&%20%22AAPL%22%20and%20startDate%20=%20%222012-01-01%22%20and%20endDate%20&%20%222012-01-10%22&format=json&env=store://datatables.org/alltableswithkeys For comparison, correctly encoded URL should be: http://query.yahooapis.com/v1/public/yql?q=select%20Date,%20Close,%20Volume%20from%20yahoo.finance.historicaldata%20where%20symbol%20=%20%22AAPL%22%20and%20startDate%20=%20%222012-01-01%22%20and%20endDate%20=%20%222012-01-10%22&format=json&env=store://datatables.org/alltableswithkeys When tried same code on desktop, and it worked fine there.

    Spring JIRA | 5 years ago | Glenn Li
    org.springframework.web.client.HttpClientErrorException: 400 Bad Request
  3. 0

    RestTemplate POST with JSon

    Stack Overflow | 4 years ago | bluelabel
    org.springframework.web.client.HttpClientErrorException: 400 Bad Request
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    AutoRun notifier fails - v1.6.3

    Google Groups | 2 years ago | Jordi
    org.springframework.web.client.HttpClientErrorException: 400 Bad Request
  6. 0

    Spring RestTemplate getForObject() giving 401 unauthorized exception

    Stack Overflow | 3 years ago | lasithc
    org.springframework.web.client.HttpClientErrorException: 401 Unauthorized

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.web.client.HttpClientErrorException

      400 Bad Request

      at org.springframework.web.client.DefaultResponseErrorHandler.handleError()
    2. Spring
      RestTemplate.handleResponseError
      1. org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76)
      2. org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:504)
      2 frames