Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration alternatives to web.xml using new features in the Servlet 3.0 API. This upgrade does *not* force Spring users to upgrade to Servlet 3.0 capable containers. Compatibility with and support for javax.servlet >= 2.4 remains. Issue: SPR-7672 git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4365 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
5049cd0db3
commit
d9b73461ff
|
|
@ -15,7 +15,7 @@
|
|||
<classpathentry kind="var" path="IVY_CACHE/javax.faces/com.springsource.javax.faces/1.2.0.08/com.springsource.javax.faces-1.2.0.08.jar" sourcepath="/IVY_CACHE/javax.faces/com.springsource.javax.faces/1.2.0.08/com.springsource.javax.faces-sources-1.2.0.08.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.portlet/com.springsource.javax.portlet/2.0.0/com.springsource.javax.portlet-2.0.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-2.1.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-sources-2.1.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-3.0.0.v201103241009.jar" sourcepath="IVY_CACHE/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-sources-3.0.0.v201103241009.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.xml.rpc/com.springsource.javax.xml.rpc/1.1.0/com.springsource.javax.xml.rpc-1.1.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.xml.soap/com.springsource.javax.xml.soap/1.3.0/com.springsource.javax.xml.soap-1.3.0.jar" sourcepath="/IVY_CACHE/javax.xml.soap/com.springsource.javax.xml.soap/1.3.0/com.springsource.javax.xml.soap-sources-1.3.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar" sourcepath="/IVY_CACHE/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-sources-1.0.0.jar"/>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
<dependency org="javax.faces" name="com.springsource.javax.faces" rev="1.2.0.08"
|
||||
conf="provided, faces->compile"/>
|
||||
<dependency org="javax.portlet" name="com.springsource.javax.portlet" rev="2.0.0" conf="provided->compile"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="2.5.0" conf="provided->compile"/>
|
||||
<dependency org="javax.servlet" name="javax.servlet" rev="3.0.0.v201103241009" conf="provided->compile"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp" rev="2.1.0"
|
||||
conf="provided, jsp->compile"/>
|
||||
<dependency org="javax.xml.rpc" name="com.springsource.javax.xml.rpc" rev="1.1.0"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2011 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.
|
||||
|
|
@ -18,6 +18,7 @@ package org.springframework.mock.web;
|
|||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
|
|
@ -34,19 +35,28 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.AsyncContext;
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.http.Part;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
|
||||
/**
|
||||
* Mock implementation of the {@link javax.servlet.http.HttpServletRequest}
|
||||
* interface. Supports the Servlet 2.5 API level.
|
||||
* interface. Supports the Servlet 2.5 API level; throws
|
||||
* {@link UnsupportedOperationException} for all methods introduced in Servlet 3.0.
|
||||
*
|
||||
* <p>Used for testing the web framework; also useful for testing
|
||||
* application controllers.
|
||||
|
|
@ -55,6 +65,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
|
|||
* @author Rod Johnson
|
||||
* @author Rick Evans
|
||||
* @author Mark Fisher
|
||||
* @author Chris Beams
|
||||
* @since 1.0.2
|
||||
*/
|
||||
public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
|
@ -847,4 +858,53 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
|||
return isRequestedSessionIdFromURL();
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Methods introduced in Servlet 3.0
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public AsyncContext getAsyncContext() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public DispatcherType getDispatcherType() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean isAsyncSupported() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public AsyncContext startAsync() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean isAsyncStarted() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Part getPart(String arg0) throws IOException, IllegalStateException, ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void login(String arg0, String arg1) throws ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void logout() throws ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 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.
|
||||
|
|
@ -39,7 +39,7 @@ import org.springframework.web.util.WebUtils;
|
|||
|
||||
/**
|
||||
* Mock implementation of the {@link javax.servlet.http.HttpServletResponse}
|
||||
* interface. Supports the Servlet 2.5 API level.
|
||||
* interface. Supports the Servlet 3.0 API level
|
||||
*
|
||||
* <p>Used for testing the web framework; also useful for testing
|
||||
* application controllers.
|
||||
|
|
@ -292,9 +292,9 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
|||
* @param name the name of the header
|
||||
* @return the associated header value, or <code>null<code> if none
|
||||
*/
|
||||
public Object getHeader(String name) {
|
||||
public String getHeader(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
return (header != null ? header.getValue() : null);
|
||||
return (header != null ? header.getValue().toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -302,9 +302,9 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
|||
* @param name the name of the header
|
||||
* @return the associated header values, or an empty List if none
|
||||
*/
|
||||
public List<Object> getHeaders(String name) {
|
||||
public List<String> getHeaders(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
return (header != null ? header.getValues() : Collections.emptyList());
|
||||
return (header != null ? header.getStringValues() : Collections.<String>emptyList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 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.
|
||||
|
|
@ -23,6 +23,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
|
|
@ -30,9 +31,17 @@ import java.util.LinkedHashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.activation.FileTypeMap;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterRegistration;
|
||||
import javax.servlet.FilterRegistration.Dynamic;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRegistration;
|
||||
import javax.servlet.SessionCookieConfig;
|
||||
import javax.servlet.SessionTrackingMode;
|
||||
import javax.servlet.descriptor.JspConfigDescriptor;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
|
@ -67,8 +76,12 @@ import org.springframework.web.util.WebUtils;
|
|||
* and XmlWebApplicationContext with an underlying MockServletContext (as long as
|
||||
* the MockServletContext has been configured with a FileSystemResourceLoader).
|
||||
*
|
||||
* Supports the Servlet 3.0 API level, but throws {@link UnsupportedOperationException}
|
||||
* for all methods introduced in Servlet 3.0.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @since 1.0.2
|
||||
* @see #MockServletContext(org.springframework.core.io.ResourceLoader)
|
||||
* @see org.springframework.web.context.support.XmlWebApplicationContext
|
||||
|
|
@ -361,4 +374,119 @@ public class MockServletContext implements ServletContext {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Methods introduced in Servlet 3.0
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public Dynamic addFilter(String arg0, String arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Dynamic addFilter(String arg0, Filter arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Dynamic addFilter(String arg0, Class<? extends Filter> arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void addListener(Class<? extends EventListener> arg0) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void addListener(String arg0) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public <T extends EventListener> void addListener(T arg0) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0, String arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
|
||||
Servlet arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
|
||||
Class<? extends Servlet> arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public <T extends Filter> T createFilter(Class<T> arg0)
|
||||
throws ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public <T extends EventListener> T createListener(Class<T> arg0)
|
||||
throws ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public <T extends Servlet> T createServlet(Class<T> arg0)
|
||||
throws ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void declareRoles(String... arg0) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoader() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int getEffectiveMajorVersion() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int getEffectiveMinorVersion() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public FilterRegistration getFilterRegistration(String arg0) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public JspConfigDescriptor getJspConfigDescriptor() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ServletRegistration getServletRegistration(String arg0) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Map<String, ? extends ServletRegistration> getServletRegistrations() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public SessionCookieConfig getSessionCookieConfig() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean setInitParameter(String arg0, String arg1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void setSessionTrackingModes(Set<SessionTrackingMode> arg0)
|
||||
throws IllegalStateException, IllegalArgumentException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class ServletWebRequestTests {
|
|||
request.checkNotModified(currentTime);
|
||||
|
||||
assertEquals(200, servletResponse.getStatus());
|
||||
assertEquals(currentTime, servletResponse.getHeader("Last-Modified"));
|
||||
assertEquals(""+currentTime, servletResponse.getHeader("Last-Modified"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ Import-Template:
|
|||
javax.portlet.*;version="[2.0.0, 3.0.0)";resolution:=optional,
|
||||
javax.servlet;version="[2.4.0, 4.0.0)",
|
||||
javax.servlet.http;version="[2.4.0, 4.0.0)",
|
||||
javax.servlet.annotation;version="[3.0.0, 4.0.0)";resolution:=optional,
|
||||
javax.servlet.jsp.*;version="[2.0.0, 3.0.0)";resolution:=optional,
|
||||
javax.xml.*;version="0";resolution:=optional,
|
||||
org.aopalliance.*;version="[1.0.0, 2.0.0)",
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@
|
|||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$IVY_CACHE$/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar!/" />
|
||||
<root url="jar://$IVY_CACHE$/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-3.0.0.v201103241009.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$IVY_CACHE$/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar!/" />
|
||||
<root url="jar://$IVY_CACHE$/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-sources-3.0.0.v201103241009.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
|
|
|
|||
Loading…
Reference in New Issue