You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/05/01 10:01:17 UTC
git commit: WICKET-5168 Depend on Java 1.7 WICKET-5167 Depend on
Servlet API 3.0
Updated Branches:
refs/heads/master 320e06454 -> 06218ed23
WICKET-5168 Depend on Java 1.7
WICKET-5167 Depend on Servlet API 3.0
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/06218ed2
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/06218ed2
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/06218ed2
Branch: refs/heads/master
Commit: 06218ed2312f274ffc060e8d9c9125a8b3953138
Parents: 320e064
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed May 1 10:00:28 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed May 1 10:00:28 2013 +0200
----------------------------------------------------------------------
.../src/main/resources/archetype-resources/pom.xml | 6 +-
pom.xml | 21 +-
.../protocol/http/mock/MockHttpServletRequest.java | 73 ++++---
.../protocol/http/mock/MockServletContext.java | 184 ++++++++++++++-
.../http/servlet/XForwardedRequestWrapper.java | 8 +-
.../MetaInfStaticResourceReferenceTest.java | 78 +------
wicket-examples/pom.xml | 20 ++-
.../guice/GuiceWebApplicationFactoryTest.java | 2 +-
.../spring/SpringWebApplicationFactoryTest.java | 2 +-
9 files changed, 255 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml b/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
index 4086219..d65f954 100644
--- a/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
@@ -77,7 +77,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.10</version>
+ <version>4.11</version>
<scope>test</scope>
</dependency>
@@ -129,8 +129,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 70fbc4f..ea6a425 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,9 +29,11 @@
<description>Wicket is a Java-based open source component web application framework.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <jetty.version>7.6.3.v20120416</jetty.version>
+ <mvn.build.java.version>1.7</mvn.build.java.version>
+ <jetty.version>8.1.10.v20130312</jetty.version>
<jetty9.version>9.0.2.v20130417</jetty9.version>
<spring.version>3.0.7.RELEASE</spring.version>
+ <servlet-api.version>3.0.1</servlet-api.version>
<maven.javadoc.version>2.8.1</maven.javadoc.version>
<maven.surefire.version>2.12.2</maven.surefire.version>
</properties>
@@ -366,8 +368,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -473,9 +475,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>httpunit</groupId>
+ <groupId>org.httpunit</groupId>
<artifactId>httpunit</artifactId>
- <version>1.6.1</version>
+ <version>1.7.2</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -493,7 +495,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
@@ -645,8 +647,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>${mvn.build.java.version}</source>
+ <target>${mvn.build.java.version}</target>
+ <compilerVersion>${mvn.build.java.version}</compilerVersion>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <showWarnings>true</showWarnings>
<optimize>true</optimize>
<debug>true</debug>
</configuration>
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/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 82c3923..de0ce51 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
@@ -41,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;
@@ -1204,6 +1211,34 @@ public class MockHttpServletRequest implements HttpServletRequest
return false;
}
+ @Override
+ public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
+ {
+ return false;
+ }
+
+ @Override
+ public void login(String username, String password) throws ServletException
+ {
+ }
+
+ @Override
+ public void logout() throws ServletException
+ {
+ }
+
+ @Override
+ public Collection<Part> getParts() throws IOException, ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public Part getPart(String name) throws IOException, ServletException
+ {
+ return null;
+ }
+
/**
* Check whether session id is from a url rewrite. Always returns false.
*
@@ -1826,64 +1861,40 @@ 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;
}
- public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
- throws IllegalStateException
+ @Override
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException
{
return null;
}
+ @Override
public boolean isAsyncStarted()
{
return false;
}
+ @Override
public boolean isAsyncSupported()
{
return false;
}
+ @Override
public AsyncContext getAsyncContext()
{
return null;
}
+ @Override
public DispatcherType getDispatcherType()
{
return null;
}
- public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
- {
- return false;
- }
-
- public void login(String username, String password) throws ServletException
- {
- }
-
- public void logout() throws ServletException
- {
- }
-
- public Collection<Part> getParts() throws IOException, ServletException
- {
- return null;
- }
-
- public Part getPart(String name) throws IOException, ServletException
- {
- return null;
- }
- */
- // @formatter:on
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/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 c18a791..70af32e 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,23 @@ 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.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;
@@ -217,13 +225,10 @@ public class MockServletContext implements ServletContext
return Collections.enumeration(initParameters.keySet());
}
- /**
- * @return Always 2
- */
@Override
- public int getMajorVersion()
+ public boolean setInitParameter(String name, String value)
{
- return 2;
+ return false;
}
/**
@@ -248,13 +253,28 @@ public class MockServletContext implements ServletContext
}
}
- /**
- * @return Always 5
- */
+ @Override
+ public int getMajorVersion()
+ {
+ return 3;
+ }
+
@Override
public int getMinorVersion()
{
- return 5;
+ return 0;
+ }
+
+ @Override
+ public int getEffectiveMajorVersion()
+ {
+ return 3;
+ }
+
+ @Override
+ public int getEffectiveMinorVersion()
+ {
+ return 0;
}
/**
@@ -346,20 +366,25 @@ public class MockServletContext implements ServletContext
return null;
}
+ URL result = null;
+
if (name.startsWith("/"))
{
name = name.substring(1);
}
File f = new File(webappRoot, name);
- if (!f.exists())
+ if (f.exists())
{
- return null;
+ result = f.toURI().toURL();
}
- else
+
+ if (result == null)
{
- return f.toURI().toURL();
+ result = getClass().getClassLoader().getResource("META-INF/resources/" + name);
}
+
+ return result;
}
/**
@@ -507,6 +532,139 @@ public class MockServletContext implements ServletContext
return application.getName();
}
+ @Override
+ public ServletRegistration.Dynamic addServlet(String servletName, String className)
+ {
+ return null;
+ }
+
+ @Override
+ public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet)
+ {
+ return null;
+ }
+
+ @Override
+ public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass)
+ {
+ return null;
+ }
+
+ @Override
+ public <T extends Servlet> T createServlet(Class<T> clazz) throws ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public ServletRegistration getServletRegistration(String servletName)
+ {
+ return null;
+ }
+
+ @Override
+ public Map<String, ? extends ServletRegistration> getServletRegistrations()
+ {
+ return null;
+ }
+
+ @Override
+ public FilterRegistration.Dynamic addFilter(String filterName, String className)
+ {
+ return null;
+ }
+
+ @Override
+ public FilterRegistration.Dynamic addFilter(String filterName, Filter filter)
+ {
+ return null;
+ }
+
+ @Override
+ public FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass)
+ {
+ return null;
+ }
+
+ @Override
+ public <T extends Filter> T createFilter(Class<T> clazz) throws ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public FilterRegistration getFilterRegistration(String filterName)
+ {
+ return null;
+ }
+
+ @Override
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations()
+ {
+ return null;
+ }
+
+ @Override
+ public SessionCookieConfig getSessionCookieConfig()
+ {
+ return null;
+ }
+
+ @Override
+ public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)
+ {
+ }
+
+ @Override
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
+ {
+ return null;
+ }
+
+ @Override
+ public void addListener(String className)
+ {
+ }
+
+ @Override
+ public <T extends EventListener> void addListener(T t)
+ {
+ }
+
+ @Override
+ public void addListener(Class<? extends EventListener> listenerClass)
+ {
+ }
+
+ @Override
+ public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor()
+ {
+ return null;
+ }
+
+ @Override
+ public ClassLoader getClassLoader()
+ {
+ return null;
+ }
+
+ @Override
+ public void declareRoles(String... roleNames)
+ {
+ }
+
/**
* NOT USED - Servlet spec requires that this always returns null.
*
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/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..0ec350a 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
@@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
/**
- * {@link href http://code.google.com/p/xebia-france/wiki/XForwardedFilter}
+ * See <a href="http://code.google.com/p/xebia-france/wiki/XForwardedFilter">XForwardedFilter</a>
*
* @author Juergen Donnerstag
*/
@@ -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/06218ed2/wicket-core/src/test/java/org/apache/wicket/request/resource/MetaInfStaticResourceReferenceTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/request/resource/MetaInfStaticResourceReferenceTest.java b/wicket-core/src/test/java/org/apache/wicket/request/resource/MetaInfStaticResourceReferenceTest.java
index d60e399..5333e31 100644
--- a/wicket-core/src/test/java/org/apache/wicket/request/resource/MetaInfStaticResourceReferenceTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/request/resource/MetaInfStaticResourceReferenceTest.java
@@ -20,7 +20,6 @@ import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
-import org.apache.wicket.Application;
import org.apache.wicket.mock.MockApplication;
import org.apache.wicket.mock.MockWebRequest;
import org.apache.wicket.protocol.http.mock.MockServletContext;
@@ -42,37 +41,6 @@ public class MetaInfStaticResourceReferenceTest
private static final String STATIC_RESOURCE_NAME = "sample.js";
/**
- * Test with Servlet 2.5 container
- */
- @Test
- public void testWithServlet25()
- {
- BaseWicketTester tester = new BaseWicketTester();
-
- MetaInfStaticResourceReference metaRes = new MetaInfStaticResourceReference(getClass(),
- STATIC_RESOURCE_NAME);
- PackageResourceReference packRes = new PackageResourceReference(getClass(),
- STATIC_RESOURCE_NAME);
-
- Url packUrl = tester.getRequestCycle().mapUrlFor(packRes, null);
- Url metaUrl = tester.getRequestCycle().mapUrlFor(metaRes, null);
-
- Assert.assertNotNull(metaUrl);
-
- // under 2.5 there should not be any difference between meta and pack resource urls
- Assert.assertEquals(metaUrl, packUrl);
-
- MockWebRequest request = new MockWebRequest(metaUrl);
-
- IRequestHandler requestHandler = tester.getApplication()
- .getRootRequestMapper()
- .mapRequest(request);
-
- // meta resource is served by wicket under 2.5
- Assert.assertNotNull(requestHandler);
- }
-
- /**
* Test with Servlet 3.0 container
*
* @throws MalformedURLException
@@ -82,7 +50,7 @@ public class MetaInfStaticResourceReferenceTest
public void testWithServlet30() throws MalformedURLException
{
MockApplication application = new MockApplication();
- MockServletContext servletContext = new MockServletContext30(application, null);
+ MockServletContext servletContext = new MockServletContext(application, "/");
BaseWicketTester tester = new BaseWicketTester(application, servletContext);
MetaInfStaticResourceReference metaRes = new MetaInfStaticResourceReference(getClass(),
@@ -100,7 +68,7 @@ public class MetaInfStaticResourceReferenceTest
metaUrl.equals(packUrl));
String metaUrlStr = metaUrl.toString();
- if (!metaUrlStr.startsWith("/"))
+ if (metaUrlStr.charAt(1) != '/')
{
metaUrlStr = "/" + metaUrlStr;
}
@@ -148,46 +116,4 @@ public class MetaInfStaticResourceReferenceTest
before();
}
- /**
- * Partial mock implementation for Servlet 3.0 ServletContext.
- */
- private static class MockServletContext30 extends MockServletContext
- {
- public MockServletContext30(Application application, String path)
- {
- super(application, path);
- }
-
- @Override
- public URL getResource(String name) throws MalformedURLException
- {
- URL url = super.getResource(name);
-
- if (url != null)
- {
- return url;
- }
-
- return getClass().getClassLoader().getResource("META-INF/resources" + name);
- }
-
- /**
- * @return 3
- */
- @Override
- public int getMajorVersion()
- {
- return 3;
- }
-
- /**
- * @return 0
- */
- @Override
- public int getMinorVersion()
- {
- return 0;
- }
-
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/wicket-examples/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml
index 5a6b4b7..82e4303 100644
--- a/wicket-examples/pom.xml
+++ b/wicket-examples/pom.xml
@@ -32,6 +32,10 @@
</description>
<dependencies>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
</dependency>
@@ -57,7 +61,7 @@
<artifactId>hibernate-validator</artifactId>
<version>4.3.0.Final</version>
</dependency>
- <!-- / bean validation -->
+ <!-- / bean validation -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-jmx</artifactId>
@@ -99,9 +103,15 @@
<groupId>com.uwyn</groupId>
<artifactId>jhighlight</artifactId>
<version>1.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>httpunit</groupId>
+ <groupId>org.httpunit</groupId>
<artifactId>httpunit</artifactId>
</dependency>
<dependency>
@@ -130,6 +140,12 @@
<groupId>org.jboss.seam.conversation</groupId>
<artifactId>seam-conversation-weld</artifactId>
<version>3.0.0.Final</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/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 b2db825..3bfddb3 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
@@ -88,7 +88,7 @@ public class GuiceWebApplicationFactoryTest
}
@Override
- public Enumeration<?> getInitParameterNames()
+ public Enumeration<String> getInitParameterNames()
{
return null;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/06218ed2/wicket-spring/src/test/java/org/apache/wicket/spring/SpringWebApplicationFactoryTest.java
----------------------------------------------------------------------
diff --git a/wicket-spring/src/test/java/org/apache/wicket/spring/SpringWebApplicationFactoryTest.java b/wicket-spring/src/test/java/org/apache/wicket/spring/SpringWebApplicationFactoryTest.java
index ad1c9f5..89bf3e4 100644
--- a/wicket-spring/src/test/java/org/apache/wicket/spring/SpringWebApplicationFactoryTest.java
+++ b/wicket-spring/src/test/java/org/apache/wicket/spring/SpringWebApplicationFactoryTest.java
@@ -87,7 +87,7 @@ public class SpringWebApplicationFactoryTest extends Assert
}
@Override
- public Enumeration<?> getInitParameterNames()
+ public Enumeration<String> getInitParameterNames()
{
throw new UnsupportedOperationException();
}