upgrade to servlet 3.0

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/53c90c22
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/53c90c22
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/53c90c22

Branch: refs/heads/sandbox/servlet3
Commit: 53c90c229cb9742c79159358637c27a0d60c8c43
Parents: 8d9623d
Author: Emond Papegaaij <[email protected]>
Authored: Tue Apr 3 08:40:47 2012 +0200
Committer: Emond Papegaaij <[email protected]>
Committed: Thu Apr 19 11:04:23 2012 +0200

----------------------------------------------------------------------
 pom.xml                                            |    6 +-
 .../protocol/http/mock/MockHttpServletRequest.java |   68 +++++++++------
 .../protocol/http/mock/MockServletContext.java     |   15 ++--
 .../http/servlet/XForwardedRequestWrapper.java     |    6 +-
 .../guice/GuiceWebApplicationFactoryTest.java      |    5 +-
 5 files changed, 59 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/53c90c22/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 141c96b..544c460 100644
--- a/pom.xml
+++ b/pom.xml
@@ -301,8 +301,8 @@
             </dependency>
             <dependency>
                 <groupId>javax.servlet</groupId>
-                <artifactId>servlet-api</artifactId>
-                <version>2.5</version>
+                <artifactId>javax.servlet-api</artifactId>
+                <version>3.0.1</version>
                 <scope>provided</scope>
             </dependency>
             <dependency>
@@ -428,7 +428,7 @@
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
+            <artifactId>javax.servlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/wicket/blob/53c90c22/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
index 3fa725d..74733e9 100755
--- 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
@@ -30,6 +30,7 @@ import java.text.DateFormat;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Enumeration;
@@ -40,12 +41,19 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
+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.apache.wicket.Application;
 import org.apache.wicket.WicketRuntimeException;
@@ -295,7 +303,7 @@ public class MockHttpServletRequest implements 
HttpServletRequest
 
        /**
         * Sets a header to the request. Overrides any previous value of this 
header.
-        *
+        * 
         * @param name
         *            The name of the header to add
         * @param value
@@ -383,7 +391,7 @@ public class MockHttpServletRequest implements 
HttpServletRequest
        {
                return Charset.forName(characterEncoding);
        }
-       
+
        /**
         * true will force Request generate multiPart ContentType and 
ContentLength
         * 
@@ -1016,18 +1024,18 @@ public class MockHttpServletRequest implements 
HttpServletRequest
        /**
         * Sets the scheme of this request
         * <p/>
-        * set the <code>secure</code> flag accordingly 
-        * (<code>true</code> for 'https', <code>false</code> otherwise) 
+        * set the <code>secure</code> flag accordingly (<code>true</code> for 
'https',
+        * <code>false</code> otherwise)
         * 
         * @param scheme
-        *          protocol scheme (e.g. https, http, ftp)
+        *            protocol scheme (e.g. https, http, ftp)
         * 
-        * @see #isSecure() 
+        * @see #isSecure()
         */
        public void setScheme(String scheme)
        {
                this.scheme = scheme;
-               this.secure = "https".equalsIgnoreCase(scheme);
+               secure = "https".equalsIgnoreCase(scheme);
        }
 
        /**
@@ -1107,7 +1115,7 @@ public class MockHttpServletRequest implements 
HttpServletRequest
                HttpSession sess = null;
                if (session instanceof MockHttpSession)
                {
-                       MockHttpSession mockHttpSession = (MockHttpSession) 
session;
+                       MockHttpSession mockHttpSession = 
(MockHttpSession)session;
                        if (b)
                        {
                                mockHttpSession.setTemporary(false);
@@ -1739,7 +1747,7 @@ public class MockHttpServletRequest implements 
HttpServletRequest
                        path = getContextPath() + getServletPath() + '/' + path;
                }
                this.url = path;
-               
+
                if (path.startsWith(getContextPath()))
                {
                        path = path.substring(getContextPath().length());
@@ -1752,12 +1760,12 @@ public class MockHttpServletRequest implements 
HttpServletRequest
                setPath(path);
 
                //
-               // We can't clear the parameters here because users may have 
set custom 
-               // parameters in request. An better place to clear they is when 
tester 
+               // We can't clear the parameters here because users may have 
set custom
+               // parameters in request. An better place to clear they is when 
tester
                // setups the next request cycle
                //
                // parameters.clear();
-               
+
                for (QueryParameter parameter : url.getQueryParameters())
                {
                        addParameter(parameter.getName(), parameter.getValue());
@@ -1814,64 +1822,70 @@ public class MockHttpServletRequest implements 
HttpServletRequest
                return context;
        }
 
-       // @formatter:off
-       /* TODO JAVA6,SERVLET3.0
-        * servlet 3.0 stuff
-        * 
-       
+       @Override
        public AsyncContext startAsync() throws IllegalStateException
        {
-               return null;
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public AsyncContext startAsync(ServletRequest servletRequest, 
ServletResponse servletResponse)
                throws IllegalStateException
        {
-               return null;
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public boolean isAsyncStarted()
        {
-               return false;
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public boolean isAsyncSupported()
        {
                return false;
        }
 
+       @Override
        public AsyncContext getAsyncContext()
        {
-               return null;
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public DispatcherType getDispatcherType()
        {
-               return null;
+               return DispatcherType.REQUEST;
        }
 
+       @Override
        public boolean authenticate(HttpServletResponse response) throws 
IOException, ServletException
        {
-               return false;
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public void login(String username, String password) throws 
ServletException
        {
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public void logout() throws ServletException
        {
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public Collection<Part> getParts() throws IOException, ServletException
        {
-               return null;
+               throw new UnsupportedOperationException();
        }
 
+       @Override
        public Part getPart(String name) throws IOException, ServletException
        {
-               return null;
+               throw new UnsupportedOperationException();
        }
-       */
-       // @formatter:on
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/53c90c22/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
index bb18416..3cbd678 100755
--- 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
@@ -25,15 +25,24 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.EventListener;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.ServletRegistration.Dynamic;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
 
 import org.apache.wicket.Application;
 import org.apache.wicket.util.string.Strings;
@@ -592,10 +601,6 @@ public class MockServletContext implements ServletContext
                return "";
        }
 
-       // @formatter:off
-       /* TODO JAVA6,SERVLET3.0
-        * servlet 3.0 stuff
-        * 
        public int getEffectiveMajorVersion()
        {
                return 0;
@@ -721,6 +726,4 @@ public class MockServletContext implements ServletContext
        public void declareRoles(String... roleNames)
        {
        }
-       */
-       // @formatter:on
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/53c90c22/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/XForwardedRequestWrapper.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/XForwardedRequestWrapper.java
 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/XForwardedRequestWrapper.java
index ee23c1f..3b68690 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/XForwardedRequestWrapper.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/XForwardedRequestWrapper.java
@@ -153,7 +153,7 @@ public class XForwardedRequestWrapper extends 
HttpServletRequestWrapper
         * @see javax.servlet.http.HttpServletRequestWrapper#getHeaderNames()
         */
        @Override
-       public Enumeration<?> getHeaderNames()
+       public Enumeration<String> getHeaderNames()
        {
                return Collections.enumeration(headers.keySet());
        }
@@ -162,12 +162,12 @@ public class XForwardedRequestWrapper extends 
HttpServletRequestWrapper
         * @see 
javax.servlet.http.HttpServletRequestWrapper#getHeaders(java.lang.String)
         */
        @Override
-       public Enumeration<?> getHeaders(final String name)
+       public Enumeration<String> getHeaders(final String name)
        {
                Map.Entry<String, List<String>> header = getHeaderEntry(name);
                if (header == null || header.getValue() == null)
                {
-                       return Collections.enumeration(Collections.emptyList());
+                       return Collections.enumeration(Collections.<String> 
emptyList());
                }
                else
                {

http://git-wip-us.apache.org/repos/asf/wicket/blob/53c90c22/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceWebApplicationFactoryTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceWebApplicationFactoryTest.java
 
b/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceWebApplicationFactoryTest.java
index a48b740..c5f19bc 100644
--- 
a/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceWebApplicationFactoryTest.java
+++ 
b/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceWebApplicationFactoryTest.java
@@ -21,13 +21,14 @@ import java.util.Enumeration;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletContext;
 
-import com.google.inject.AbstractModule;
 import org.apache.wicket.Page;
 import org.apache.wicket.protocol.http.WebApplication;
 import org.apache.wicket.protocol.http.WicketFilter;
 import org.apache.wicket.protocol.http.mock.MockServletContext;
 import org.junit.Test;
 
+import com.google.inject.AbstractModule;
+
 /**
  */
 public class GuiceWebApplicationFactoryTest
@@ -85,7 +86,7 @@ public class GuiceWebApplicationFactoryTest
                                                return new 
MockServletContext(null, null);
                                        }
 
-                                       public Enumeration<?> 
getInitParameterNames()
+                                       public Enumeration<String> 
getInitParameterNames()
                                        {
                                                return null;
                                        }

Reply via email to