You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have upgraded to Tomcat7 and also upgraded with servlet3.0 jar. Now while compiling our code which is creating a new instance of MockHttpServletResponse we are getting compolation error as:--
getHeaders(java.lang.String) in org.springframework.mock.web.MockHttpServletResponse cannot implement getHeaders(java.lang.String) in javax.servlet.http.HttpServletResponse; attempting to use incompatible return type
[groovyc] found : java.util.List<java.lang.Object>
[groovyc] required: java.util.Collection<java.lang.String>
[groovyc] MockHttpServletResponse response = new MockHttpServletResponse() {
After seeing the code we found that return type of getHeaders() functon have been now changed to "java.util.Collection<java.lang.String>" while spring still returning as "List". We are usnig spring 3.0.3. We checked the code in spring 3.0.5 which also have same issue.
Thanks for taking it care of it.
Not sure if this is the right place to ask this question or not, Do we have any expected release schedule date for 3.1 RC1. If yes, please share, this will help us in planning to update spring.
This is due to the addition of the getHeader/getHeaders method to HttpServletResponse in the Servlet 3.0 API, whereas Spring had methods of the same name as extensions on its mock classes before. I've fixed this for Spring 3.1 where we have a Servlet 3.0 theme anyway. I've also generally upgraded our mocks to support Servlet 3.0 API methods where possible (with a couple of limitations as stated in the javadoc), while retaining compatibility with Servlet 2.4/2.5 as well.
Our Spring 3.1 MockHttpServletResponse class is slightly incompatible with its Spring 3.0 version now since getHeader/getHeaders always returns Strings. I've added separate getHeaderValue/getHeaderValues methods for raw value access which users need to migrate to now when not wanting Strings. For that reason, this is not an ideal backport candidate and will very likely only be fixed in the Spring 3.1 branch.
Pranay Kumar opened SPR-8529 and commented
We have upgraded to Tomcat7 and also upgraded with servlet3.0 jar. Now while compiling our code which is creating a new instance of MockHttpServletResponse we are getting compolation error as:--
getHeaders(java.lang.String) in org.springframework.mock.web.MockHttpServletResponse cannot implement getHeaders(java.lang.String) in javax.servlet.http.HttpServletResponse; attempting to use incompatible return type
[groovyc] found : java.util.List<java.lang.Object>
[groovyc] required: java.util.Collection<java.lang.String>
[groovyc] MockHttpServletResponse response = new MockHttpServletResponse() {
After seeing the code we found that return type of getHeaders() functon have been now changed to "java.util.Collection<java.lang.String>" while spring still returning as "List". We are usnig spring 3.0.3. We checked the code in spring 3.0.5 which also have same issue.
Affects: 3.1 M2
Referenced from: commits cc725d7, 18ab057
The text was updated successfully, but these errors were encountered: