Skip to content

AppEngine : bug with SimpleClientHttpResponse.getHeaders [SPR-7146] #11805

Closed

Description

@spring-projects-issues

Jean-Francois L. opened SPR-7146 and commented

Hi,

I'm trying to use @ResponseBody with Spring 3.0.2 on AppEngine
I got a RestClientException("Cannot extract response: no Content-Type found") :
from HttpMessageConverterExtractor (line 66) :

MediaType contentType = response.getHeaders().getContentType();
if (contentType == null) {
     throw new RestClientException("Cannot extract response: no Content-Type found");
}

The problem comes from response.getHeaders() :
the field 0 is ignored, but with AppEngine, field 0 IS Content-Type
AppEngine uses com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection as HttpURLConnection

// Header field 0 is the status line, so we start at 1
int i = 1;
while (true) {
     String name = this.connection.getHeaderFieldKey(i);
     if (!StringUtils.hasLength(name)) {
              break;
     }
     this.headers.add(name, this.connection.getHeaderField(i));
     i++;
}

Sorry for my poor english...

Thank you for your help


Affects: 3.0.2

Referenced from: commits f8a05da

Activity

  1. spring-projects-issues commented on Apr 28, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Arjen Poutsma commented

    Added formatting.

  2. added
    type: bug
    in: web
    on Jan 11, 2019
  3. added this to the 3.0.3 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions