diff --git a/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java b/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java index 96ca8f1610..7521a5ed46 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java +++ b/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,8 @@ import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.TraceMethod; import org.springframework.beans.factory.DisposableBean; -import org.springframework.util.Assert; import org.springframework.http.HttpMethod; +import org.springframework.util.Assert; /** * {@link org.springframework.http.client.ClientHttpRequestFactory} implementation that uses @@ -96,7 +96,7 @@ public class CommonsClientHttpRequestFactory implements ClientHttpRequestFactory if (timeout < 0) { throw new IllegalArgumentException("timeout must be a non-negative value"); } - this.httpClient.getHttpConnectionManager().getParams().setSoTimeout(timeout); + getHttpClient().getHttpConnectionManager().getParams().setSoTimeout(timeout); } diff --git a/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpResponse.java b/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpResponse.java index 03de968c98..8b7195a7ab 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpResponse.java +++ b/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,10 +54,14 @@ final class SimpleClientHttpResponse implements ClientHttpResponse { public HttpHeaders getHeaders() { if (this.headers == null) { this.headers = new HttpHeaders(); - // Header field 0 is the status line, so we start at 1 + // Header field 0 is the status line for most HttpURLConnections, but not on GAE + String name = this.connection.getHeaderFieldKey(0); + if (StringUtils.hasLength(name)) { + this.headers.add(name, this.connection.getHeaderField(0)); + } int i = 1; while (true) { - String name = this.connection.getHeaderFieldKey(i); + name = this.connection.getHeaderFieldKey(i); if (!StringUtils.hasLength(name)) { break; }