Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-2274

Sending back ResponseEntity<T> without Content-Type header causes RestClientExceptions when using RestTemplate

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.2.RELEASE
    • Fix Version/s: 1.1.3.RELEASE
    • Component/s: WEB MVC
    • Labels:
      None

      Description

      When using a RestTemplate to call Json Controllers built as per Roo's documentation, the code

      return new ResponseEntity<String>(HttpStatus.CREATED)

      is insufficient, because without a content-type HttpResponseExtractorConverter will throw RestClientException. This behaviour is mentioned in the open issue SPR-7908 also.

      Current workaround is to return the following:

      HttpHeaders headers= new HttpHeaders();
      headers.add("Content-Type", "application/text");
      return new ResponseEntity<String>(headers, HttpStatus.CREATED);

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sschmidt Stefan Schmidt
              Reporter:
              brad.murray@fronde.com Brad Murray
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: