diff --git a/apps/showcase/pom.xml b/apps/showcase/pom.xml
index 5c4c581c8..c2136fe7a 100644
--- a/apps/showcase/pom.xml
+++ b/apps/showcase/pom.xml
@@ -101,7 +101,7 @@
javax.servlet
- servlet-api
+ javax.servlet-api
provided
@@ -155,15 +155,6 @@
6.1.2.Final
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
diff --git a/bundles/pom.xml b/bundles/pom.xml
index 606f2358f..d34c67496 100755
--- a/bundles/pom.xml
+++ b/bundles/pom.xml
@@ -53,12 +53,10 @@
javax.servlet
- servlet-api
- 2.4
+ javax.servlet-api
provided
-
diff --git a/core/pom.xml b/core/pom.xml
index 4ae6fa027..f34b8e92e 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -188,7 +188,7 @@
javax.servlet
- servlet-api
+ javax.servlet-api
provided
@@ -345,15 +345,6 @@
test
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
commons-validator
commons-validator
diff --git a/core/src/main/java/org/apache/struts2/components/Include.java b/core/src/main/java/org/apache/struts2/components/Include.java
index 70692bf1e..2e1f862dd 100644
--- a/core/src/main/java/org/apache/struts2/components/Include.java
+++ b/core/src/main/java/org/apache/struts2/components/Include.java
@@ -25,6 +25,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.RequestUtils;
import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.util.FastByteArrayOutputStream;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
@@ -33,6 +34,7 @@ import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -296,6 +298,19 @@ public class Include extends Component {
buffer = new FastByteArrayOutputStream();
}
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setWriteListener(WriteListener writeListener) {
+ try {
+ writeListener.onWritePossible();
+ } catch (IOException e) {
+ throw new StrutsException(e);
+ }
+ }
/**
* Return all data that has been written to this OutputStream.
diff --git a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
index 3fa192584..18831e9ce 100644
--- a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
+++ b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
@@ -321,7 +321,7 @@ public class ServletUrlRenderer implements UrlRenderer {
* @param parameters component parameters
* @param contextParameters request parameters
*/
- protected void mergeRequestParameters(String value, Map parameters, Map contextParameters) {
+ protected void mergeRequestParameters(String value, Map parameters, Map contextParameters) {
Map mergedParams = new LinkedHashMap<>(contextParameters);
@@ -333,7 +333,7 @@ public class ServletUrlRenderer implements UrlRenderer {
String queryString = value.substring(value.indexOf('?') + 1);
mergedParams = urlHelper.parseQueryString(queryString, false);
- for (Map.Entry entry : contextParameters.entrySet()) {
+ for (Map.Entry entry : contextParameters.entrySet()) {
if (!mergedParams.containsKey(entry.getKey())) {
mergedParams.put(entry.getKey(), entry.getValue());
}
diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
index 7d8379c89..36cfabcc9 100644
--- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
+++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
@@ -24,11 +24,13 @@ import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.views.jsp.ui.OgnlTool;
import org.apache.struts2.views.util.UrlHelper;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -278,6 +280,20 @@ public class StrutsUtil {
public void write(int aByte) {
writer.write(aByte);
}
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setWriteListener(WriteListener writeListener) {
+ try {
+ writeListener.onWritePossible();
+ } catch (IOException e) {
+ throw new StrutsException(e);
+ }
+ }
}
}
diff --git a/core/src/main/java/org/apache/struts2/util/URLBean.java b/core/src/main/java/org/apache/struts2/util/URLBean.java
index 5e09718ff..8832b4c0e 100644
--- a/core/src/main/java/org/apache/struts2/util/URLBean.java
+++ b/core/src/main/java/org/apache/struts2/util/URLBean.java
@@ -19,7 +19,6 @@
package org.apache.struts2.util;
import com.opensymphony.xwork2.ActionContext;
-import org.apache.struts2.ServletActionContext;
import org.apache.struts2.views.util.DefaultUrlHelper;
import org.apache.struts2.views.util.UrlHelper;
@@ -58,20 +57,10 @@ public class URLBean {
public String getURL() {
// all this trickier with maps is to reduce the number of objects created
- Map fullParams = null;
-
- if (params != null) {
- fullParams = new HashMap();
- }
+ Map fullParams = new HashMap<>();
if (page == null) {
- // No particular page requested, so go to "same page"
- // Add query params to parameters
- if (fullParams != null) {
- fullParams.putAll(request.getParameterMap());
- } else {
- fullParams = request.getParameterMap();
- }
+ fullParams.putAll(request.getParameterMap());
}
// added parameters override, just like in URLTag
@@ -84,7 +73,7 @@ public class URLBean {
public URLBean addParameter(String name, Object value) {
if (params == null) {
- params = new HashMap();
+ params = new HashMap<>();
}
if (value == null) {
diff --git a/core/src/test/java/org/apache/struts2/interceptor/CookieInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/CookieInterceptorTest.java
index 69d36ce4f..afe18f731 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/CookieInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/CookieInterceptorTest.java
@@ -18,25 +18,26 @@
*/
package org.apache.struts2.interceptor;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.Cookie;
-
-import com.opensymphony.xwork2.security.DefaultAcceptedPatternsChecker;
-import com.opensymphony.xwork2.security.DefaultExcludedPatternsChecker;
-import com.opensymphony.xwork2.mock.MockActionInvocation;
-import org.springframework.mock.web.MockHttpServletRequest;
-
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsInternalTestCase;
-import static org.easymock.EasyMock.*;
-
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
+import com.opensymphony.xwork2.mock.MockActionInvocation;
+import com.opensymphony.xwork2.security.DefaultAcceptedPatternsChecker;
+import com.opensymphony.xwork2.security.DefaultExcludedPatternsChecker;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsInternalTestCase;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+import javax.servlet.http.Cookie;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
public class CookieInterceptorTest extends StrutsInternalTestCase {
@@ -44,9 +45,9 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
public void testIntercepDefault() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(
- new Cookie("cookie1", "cookie1value"),
- new Cookie("cookie2", "cookie2value"),
- new Cookie("cookie3", "cookie3value")
+ new Cookie("cookie1", "cookie1value"),
+ new Cookie("cookie2", "cookie2value"),
+ new Cookie("cookie3", "cookie3value")
);
ServletActionContext.setRequest(request);
@@ -55,7 +56,7 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
ActionContext.getContext().getValueStack().push(action);
ActionInvocation invocation = (ActionInvocation) createMock(ActionInvocation.class);
-
+
expect(invocation.getAction()).andReturn(action);
expect(invocation.invoke()).andReturn(Action.SUCCESS);
@@ -75,16 +76,16 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
assertNull(ActionContext.getContext().getValueStack().findValue("cookie1"));
assertNull(ActionContext.getContext().getValueStack().findValue("cookie2"));
assertNull(ActionContext.getContext().getValueStack().findValue("cookie3"));
-
+
verify(invocation);
}
public void testInterceptAll1() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(
- new Cookie("cookie1", "cookie1value"),
- new Cookie("cookie2", "cookie2value"),
- new Cookie("cookie3", "cookie3value")
+ new Cookie("cookie1", "cookie1value"),
+ new Cookie("cookie2", "cookie2value"),
+ new Cookie("cookie3", "cookie3value")
);
ServletActionContext.setRequest(request);
@@ -93,7 +94,7 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
ActionContext.getContext().getValueStack().push(action);
ActionInvocation invocation = (ActionInvocation) createMock(ActionInvocation.class);
-
+
expect(invocation.getAction()).andReturn(action);
expect(invocation.invoke()).andReturn(Action.SUCCESS);
@@ -117,7 +118,7 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie1"), "cookie1value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie2"), "cookie2value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie3"), "cookie3value");
-
+
verify(invocation);
}
@@ -125,9 +126,9 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
public void testInterceptAll2() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(
- new Cookie("cookie1", "cookie1value"),
- new Cookie("cookie2", "cookie2value"),
- new Cookie("cookie3", "cookie3value")
+ new Cookie("cookie1", "cookie1value"),
+ new Cookie("cookie2", "cookie2value"),
+ new Cookie("cookie3", "cookie3value")
);
ServletActionContext.setRequest(request);
@@ -159,16 +160,16 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie1"), "cookie1value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie2"), "cookie2value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie3"), "cookie3value");
-
+
verify(invocation);
}
public void testInterceptSelectedCookiesNameOnly1() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(
- new Cookie("cookie1", "cookie1value"),
- new Cookie("cookie2", "cookie2value"),
- new Cookie("cookie3", "cookie3value")
+ new Cookie("cookie1", "cookie1value"),
+ new Cookie("cookie2", "cookie2value"),
+ new Cookie("cookie3", "cookie3value")
);
ServletActionContext.setRequest(request);
@@ -200,16 +201,16 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie1"), "cookie1value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie2"), null);
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie3"), "cookie3value");
-
+
verify(invocation);
}
public void testInterceptSelectedCookiesNameOnly2() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(
- new Cookie("cookie1", "cookie1value"),
- new Cookie("cookie2", "cookie2value"),
- new Cookie("cookie3", "cookie3value")
+ new Cookie("cookie1", "cookie1value"),
+ new Cookie("cookie2", "cookie2value"),
+ new Cookie("cookie3", "cookie3value")
);
ServletActionContext.setRequest(request);
@@ -218,7 +219,7 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
ActionContext.getContext().getValueStack().push(action);
ActionInvocation invocation = (ActionInvocation) createMock(ActionInvocation.class);
-
+
expect(invocation.getAction()).andReturn(action);
expect(invocation.invoke()).andReturn(Action.SUCCESS);
@@ -242,16 +243,16 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie1"), "cookie1value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie2"), null);
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie3"), "cookie3value");
-
+
verify(invocation);
}
public void testInterceptSelectedCookiesNameOnly3() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(
- new Cookie("cookie1", "cookie1value"),
- new Cookie("cookie2", "cookie2value"),
- new Cookie("cookie3", "cookie3value")
+ new Cookie("cookie1", "cookie1value"),
+ new Cookie("cookie2", "cookie2value"),
+ new Cookie("cookie3", "cookie3value")
);
ServletActionContext.setRequest(request);
@@ -283,7 +284,7 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie1"), "cookie1value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie2"), null);
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie3"), "cookie3value");
-
+
verify(invocation);
}
@@ -291,9 +292,9 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
public void testInterceptSelectedCookiesNameAndValue() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setCookies(
- new Cookie("cookie1", "cookie1value"),
- new Cookie("cookie2", "cookie2value"),
- new Cookie("cookie3", "cookie3value")
+ new Cookie("cookie1", "cookie1value"),
+ new Cookie("cookie2", "cookie2value"),
+ new Cookie("cookie3", "cookie3value")
);
ServletActionContext.setRequest(request);
@@ -325,7 +326,7 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie1"), "cookie1value");
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie2"), null);
assertEquals(ActionContext.getContext().getValueStack().findValue("cookie3"), null);
-
+
verify(invocation);
}
@@ -338,20 +339,44 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
String pollution5 = "model[\"class\"]['classLoader']['jarPath']";
String pollution6 = "class[\"classLoader\"]['jarPath']";
+ try {
+ new Cookie(pollution1, "pollution1");
+ fail("It shouldn't be possible to create cookie: " + pollution1);
+ } catch (IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "Cookie name \"" + pollution1 + "\" is a reserved token");
+ }
+
+ try {
+ new Cookie(pollution4, "pollution4");
+ fail("It shouldn't be possible to create cookie: " + pollution4);
+ } catch (IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "Cookie name \"" + pollution4 + "\" is a reserved token");
+ }
+
+ try {
+ new Cookie(pollution5, "pollution5");
+ fail("It shouldn't be possible to create cookie: " + pollution5);
+ } catch (IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "Cookie name \"" + pollution5 + "\" is a reserved token");
+ }
+
+ try {
+ new Cookie(pollution6, "pollution6");
+ fail("It shouldn't be possible to create cookie: " + pollution6);
+ } catch (IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "Cookie name \"" + pollution6 + "\" is a reserved token");
+ }
+
request.setCookies(
- new Cookie(pollution1, "pollution1"),
- new Cookie("pollution1", pollution1),
- new Cookie(pollution2, "pollution2"),
- new Cookie("pollution2", pollution2),
- new Cookie(pollution3, "pollution3"),
- new Cookie("pollution3", pollution3),
- new Cookie(pollution4, "pollution4"),
- new Cookie("pollution4", pollution4),
- new Cookie(pollution5, "pollution5"),
- new Cookie("pollution5", pollution5),
- new Cookie(pollution6, "pollution6"),
- new Cookie("pollution6", pollution6)
- );
+ new Cookie("pollution1", pollution1),
+ new Cookie(pollution2, "pollution2"),
+ new Cookie("pollution2", pollution2),
+ new Cookie(pollution3, "pollution3"),
+ new Cookie("pollution3", pollution3),
+ new Cookie("pollution4", pollution4),
+ new Cookie("pollution5", pollution5),
+ new Cookie("pollution6", pollution6)
+ );
ServletActionContext.setRequest(request);
final Map excludedName = new HashMap();
@@ -375,12 +400,12 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
interceptor.intercept(invocation);
- assertFalse(excludedName.get(pollution1));
+ //assertFalse(excludedName.get(pollution1));
assertFalse(excludedName.get(pollution2));
assertFalse(excludedName.get(pollution3));
- assertFalse(excludedName.get(pollution4));
- assertFalse(excludedName.get(pollution5));
- assertFalse(excludedName.get(pollution6));
+ //assertFalse(excludedName.get(pollution4));
+ //assertFalse(excludedName.get(pollution5));
+// assertFalse(excludedName.get(pollution6));
}
public void testCookiesWithStrutsInternalsAccess() throws Exception {
@@ -393,13 +418,13 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
String reqCookieValue = "request.userId=1";
request.setCookies(
- new Cookie(sessionCookieName, "1"),
- new Cookie("1", sessionCookieValue),
- new Cookie(appCookieName, "1"),
- new Cookie("1", appCookieValue),
- new Cookie(reqCookieName, "1"),
- new Cookie("1", reqCookieValue)
- );
+ new Cookie(sessionCookieName, "1"),
+ new Cookie("1", sessionCookieValue),
+ new Cookie(appCookieName, "1"),
+ new Cookie("1", appCookieValue),
+ new Cookie(reqCookieName, "1"),
+ new Cookie("1", reqCookieValue)
+ );
ServletActionContext.setRequest(request);
final Map excludedName = new HashMap();
@@ -436,13 +461,13 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
String reqCookieValue = "request.userId=1";
request.setCookies(
- new Cookie(sessionCookieName, "1"),
- new Cookie("1", sessionCookieValue),
- new Cookie(appCookieName, "1"),
- new Cookie("1", appCookieValue),
- new Cookie(reqCookieName, "1"),
- new Cookie("1", reqCookieValue)
- );
+ new Cookie(sessionCookieName, "1"),
+ new Cookie("1", sessionCookieValue),
+ new Cookie(appCookieName, "1"),
+ new Cookie("1", appCookieValue),
+ new Cookie(reqCookieName, "1"),
+ new Cookie("1", reqCookieValue)
+ );
ServletActionContext.setRequest(request);
final Map excludedName = new HashMap<>();
@@ -486,14 +511,29 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
return this.cookies;
}
- public String getCookie1() { return cookie1; }
- public void setCookie1(String cookie1) { this.cookie1 = cookie1; }
+ public String getCookie1() {
+ return cookie1;
+ }
- public String getCookie2() { return cookie2; }
- public void setCookie2(String cookie2) { this.cookie2 = cookie2; }
+ public void setCookie1(String cookie1) {
+ this.cookie1 = cookie1;
+ }
- public String getCookie3() { return cookie3; }
- public void setCookie3(String cookie3) { this.cookie3 = cookie3; }
+ public String getCookie2() {
+ return cookie2;
+ }
+
+ public void setCookie2(String cookie2) {
+ this.cookie2 = cookie2;
+ }
+
+ public String getCookie3() {
+ return cookie3;
+ }
+
+ public void setCookie3(String cookie3) {
+ this.cookie3 = cookie3;
+ }
}
public static class MockActionWithActionCookieAware extends ActionSupport implements org.apache.struts2.action.CookiesAware {
@@ -511,14 +551,29 @@ public class CookieInterceptorTest extends StrutsInternalTestCase {
return this.cookies;
}
- public String getCookie1() { return cookie1; }
- public void setCookie1(String cookie1) { this.cookie1 = cookie1; }
+ public String getCookie1() {
+ return cookie1;
+ }
- public String getCookie2() { return cookie2; }
- public void setCookie2(String cookie2) { this.cookie2 = cookie2; }
+ public void setCookie1(String cookie1) {
+ this.cookie1 = cookie1;
+ }
- public String getCookie3() { return cookie3; }
- public void setCookie3(String cookie3) { this.cookie3 = cookie3; }
+ public String getCookie2() {
+ return cookie2;
+ }
+
+ public void setCookie2(String cookie2) {
+ this.cookie2 = cookie2;
+ }
+
+ public String getCookie3() {
+ return cookie3;
+ }
+
+ public void setCookie3(String cookie3) {
+ this.cookie3 = cookie3;
+ }
}
}
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java
index 0f9461c66..c677acc14 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java
@@ -23,14 +23,21 @@ 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.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.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
/**
@@ -42,12 +49,12 @@ public class StrutsMockServletContext implements ServletContext {
String realPath;
String servletInfo;
String contextPath;
- Map initParams = new HashMap();
- Map attributes = new HashMap();
+ Map initParams = new HashMap<>();
+ Map attributes = new HashMap<>();
InputStream resourceAsStream;
- public void setInitParameter(String name, String value) {
- initParams.put(name, value);
+ public boolean setInitParameter(String name, String value) {
+ return initParams.put(name, value) != null;
}
public void setRealPath(String value) {
@@ -74,7 +81,7 @@ public class StrutsMockServletContext implements ServletContext {
return null;
}
- public Set getResourcePaths(String s) {
+ public Set getResourcePaths(String s) {
return null;
}
@@ -105,11 +112,11 @@ public class StrutsMockServletContext implements ServletContext {
return null;
}
- public Enumeration getServlets() {
+ public Enumeration getServlets() {
return null;
}
- public Enumeration getServletNames() {
+ public Enumeration getServletNames() {
return null;
}
@@ -130,7 +137,7 @@ public class StrutsMockServletContext implements ServletContext {
return (String) initParams.get(s);
}
- public Enumeration getInitParameterNames() {
+ public Enumeration getInitParameterNames() {
return Collections.enumeration(initParams.keySet());
}
@@ -138,7 +145,7 @@ public class StrutsMockServletContext implements ServletContext {
return attributes.get(s);
}
- public Enumeration getAttributeNames() {
+ public Enumeration getAttributeNames() {
return Collections.enumeration(attributes.keySet());
}
@@ -157,12 +164,142 @@ public class StrutsMockServletContext implements ServletContext {
public void setServletInfo(String servletInfo) {
this.servletInfo = servletInfo;
}
-
+
public String getContextPath() {
return contextPath;
- }
+ }
public void setContextPath(String contextPath) {
this.contextPath = contextPath;
}
+
+ @Override
+ public int getEffectiveMajorVersion() {
+ return 0;
+ }
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ return 0;
+ }
+
+ @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 createServlet(Class clazz) throws ServletException {
+ return null;
+ }
+
+ @Override
+ public ServletRegistration getServletRegistration(String servletName) {
+ return null;
+ }
+
+ @Override
+ public Map 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 createFilter(Class clazz) throws ServletException {
+ return null;
+ }
+
+ @Override
+ public FilterRegistration getFilterRegistration(String filterName) {
+ return null;
+ }
+
+ @Override
+ public Map getFilterRegistrations() {
+ return null;
+ }
+
+ @Override
+ public SessionCookieConfig getSessionCookieConfig() {
+ return null;
+ }
+
+ @Override
+ public void setSessionTrackingModes(Set sessionTrackingModes) {
+
+ }
+
+ @Override
+ public Set getDefaultSessionTrackingModes() {
+ return null;
+ }
+
+ @Override
+ public Set getEffectiveSessionTrackingModes() {
+ return null;
+ }
+
+ @Override
+ public void addListener(String className) {
+
+ }
+
+ @Override
+ public void addListener(T t) {
+
+ }
+
+ @Override
+ public void addListener(Class extends EventListener> listenerClass) {
+
+ }
+
+ @Override
+ public T createListener(Class clazz) throws ServletException {
+ return null;
+ }
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ return null;
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return null;
+ }
+
+ @Override
+ public void declareRoles(String... roleNames) {
+
+ }
+
+ @Override
+ public String getVirtualServerName() {
+ return null;
+ }
}
diff --git a/plugins/embeddedjsp/pom.xml b/plugins/embeddedjsp/pom.xml
index f8c56b547..ceab2252d 100644
--- a/plugins/embeddedjsp/pom.xml
+++ b/plugins/embeddedjsp/pom.xml
@@ -89,15 +89,6 @@
tomcat-jasper
provided
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
diff --git a/plugins/jasperreports/pom.xml b/plugins/jasperreports/pom.xml
index eb0eb0808..ffc6675ed 100644
--- a/plugins/jasperreports/pom.xml
+++ b/plugins/jasperreports/pom.xml
@@ -63,12 +63,6 @@
jsp-api
provided
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
org.springframework
spring-web
diff --git a/plugins/jfreechart/pom.xml b/plugins/jfreechart/pom.xml
index 30681863f..61bcedda9 100644
--- a/plugins/jfreechart/pom.xml
+++ b/plugins/jfreechart/pom.xml
@@ -19,13 +19,14 @@
* under the License.
*/
-->
-
+
4.0.0
org.apache.struts
struts2-plugins
6.0.0-SNAPSHOT
-
+
struts2-jfreechart-plugin
jar
@@ -71,18 +72,9 @@
easymock
test
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
+
- UTF-8
+ UTF-8
diff --git a/plugins/json/pom.xml b/plugins/json/pom.xml
index 4f9004cc5..5b296f3a7 100644
--- a/plugins/json/pom.xml
+++ b/plugins/json/pom.xml
@@ -19,7 +19,8 @@
* under the License.
*/
-->
-
+
4.0.0
org.apache.struts
@@ -105,18 +106,10 @@
assertj-core
test
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
+
- UTF-8
+ UTF-8
+
diff --git a/plugins/junit/pom.xml b/plugins/junit/pom.xml
index 4a7e51369..bade83131 100644
--- a/plugins/junit/pom.xml
+++ b/plugins/junit/pom.xml
@@ -19,7 +19,8 @@
* under the License.
*/
-->
-
+
4.0.0
org.apache.struts
@@ -85,17 +86,9 @@
struts2-portlet-mocks-plugin
true
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
+
- UTF-8
+ UTF-8
diff --git a/plugins/osgi/pom.xml b/plugins/osgi/pom.xml
index dfdc0557f..56753608b 100644
--- a/plugins/osgi/pom.xml
+++ b/plugins/osgi/pom.xml
@@ -106,15 +106,6 @@
test
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
org.apache.logging.log4j
log4j-core
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 4150947c4..552c477e0 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -76,7 +76,7 @@
javax.servlet
- servlet-api
+ javax.servlet-api
provided
diff --git a/plugins/portlet-mocks/pom.xml b/plugins/portlet-mocks/pom.xml
index e4bf15a00..c516946d8 100644
--- a/plugins/portlet-mocks/pom.xml
+++ b/plugins/portlet-mocks/pom.xml
@@ -19,7 +19,8 @@
* under the License.
*/
-->
-
+
4.0.0
org.apache.struts
@@ -47,16 +48,8 @@
portlet-api
provided
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
+
UTF-8
diff --git a/plugins/portlet/pom.xml b/plugins/portlet/pom.xml
index da4bc9bf0..2c12c7c2c 100644
--- a/plugins/portlet/pom.xml
+++ b/plugins/portlet/pom.xml
@@ -19,7 +19,8 @@
* under the License.
*/
-->
-
+
4.0.0
org.apache.struts
@@ -139,17 +140,10 @@
commons-fileupload
test
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
+
- UTF-8
+ UTF-8
+
diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
index 40b29b12b..f52ba4dc6 100644
--- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
+++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
@@ -20,14 +20,22 @@ package org.apache.struts2.portlet.servlet;
import javax.portlet.PortletContext;
import javax.portlet.PortletRequestDispatcher;
+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.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
import java.util.Set;
/**
@@ -86,6 +94,11 @@ public class PortletServletContext implements ServletContext {
return portletContext.getInitParameterNames();
}
+ @Override
+ public boolean setInitParameter(String name, String value) {
+ return false;
+ }
+
/* (non-Javadoc)
* @see javax.servlet.ServletContext#getMajorVersion()
*/
@@ -107,6 +120,16 @@ public class PortletServletContext implements ServletContext {
return portletContext.getMinorVersion();
}
+ @Override
+ public int getEffectiveMajorVersion() {
+ return 0;
+ }
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ return 0;
+ }
+
/**
* Returns a {@link PortletServletRequestDispatcher} wrapping the {@link PortletRequestDispatcher}
* as a {@link RequestDispatcher} instance.
@@ -179,6 +202,126 @@ public class PortletServletContext implements ServletContext {
return portletContext.getPortletContextName();
}
+ @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 createServlet(Class clazz) throws ServletException {
+ return null;
+ }
+
+ @Override
+ public ServletRegistration getServletRegistration(String servletName) {
+ return null;
+ }
+
+ @Override
+ public Map 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 createFilter(Class clazz) throws ServletException {
+ return null;
+ }
+
+ @Override
+ public FilterRegistration getFilterRegistration(String filterName) {
+ return null;
+ }
+
+ @Override
+ public Map getFilterRegistrations() {
+ return null;
+ }
+
+ @Override
+ public SessionCookieConfig getSessionCookieConfig() {
+ return null;
+ }
+
+ @Override
+ public void setSessionTrackingModes(Set sessionTrackingModes) {
+
+ }
+
+ @Override
+ public Set getDefaultSessionTrackingModes() {
+ return null;
+ }
+
+ @Override
+ public Set getEffectiveSessionTrackingModes() {
+ return null;
+ }
+
+ @Override
+ public void addListener(String className) {
+
+ }
+
+ @Override
+ public void addListener(T t) {
+
+ }
+
+ @Override
+ public void addListener(Class extends EventListener> listenerClass) {
+
+ }
+
+ @Override
+ public T createListener(Class clazz) throws ServletException {
+ return null;
+ }
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ return null;
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return null;
+ }
+
+ @Override
+ public void declareRoles(String... roleNames) {
+
+ }
+
+ @Override
+ public String getVirtualServerName() {
+ return null;
+ }
+
/**
* @throws IllegalStateException Not supported in a portlet.
* @see javax.servlet.ServletContext#getServletNames()
diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
index 78b5c95fb..510248b3e 100644
--- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
+++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
@@ -21,6 +21,7 @@ package org.apache.struts2.portlet.servlet;
import java.io.IOException;
import java.io.InputStream;
+import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
/**
@@ -31,11 +32,11 @@ import javax.servlet.ServletInputStream;
public class PortletServletInputStream extends ServletInputStream {
private InputStream portletInputStream;
-
+
public PortletServletInputStream(InputStream portletInputStream) {
this.portletInputStream = portletInputStream;
}
-
+
/* (non-Javadoc)
* @see java.io.InputStream#read()
*/
@@ -107,7 +108,7 @@ public class PortletServletInputStream extends ServletInputStream {
public long skip(long n) throws IOException {
return portletInputStream.skip(n);
}
-
+
/**
* Get the wrapped {@link InputStream} instance.
* @return The wrapped {@link InputStream} instance.
@@ -116,4 +117,18 @@ public class PortletServletInputStream extends ServletInputStream {
return portletInputStream;
}
+ @Override
+ public boolean isFinished() {
+ return true;
+ }
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setReadListener(ReadListener readListener) {
+ // no-op
+ }
}
diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
index 94f114fa4..6a297d743 100644
--- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
+++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
/**
* Wrapper object exposing a {@link OutputStream} from a portlet as a {@link ServletOutputStream} instance.
@@ -31,7 +32,7 @@ import javax.servlet.ServletOutputStream;
public class PortletServletOutputStream extends ServletOutputStream {
private OutputStream portletOutputStream;
-
+
public PortletServletOutputStream(OutputStream portletOutputStream) {
this.portletOutputStream = portletOutputStream;
}
@@ -75,7 +76,7 @@ public class PortletServletOutputStream extends ServletOutputStream {
public void write(byte[] b, int off, int len) throws IOException {
portletOutputStream.write(b, off, len);
}
-
+
/**
* Get the wrapped {@link OutputStream} instance.
* @return The wrapped {@link OutputStream} instance.
@@ -83,4 +84,14 @@ public class PortletServletOutputStream extends ServletOutputStream {
public OutputStream getOutputStream() {
return portletOutputStream;
}
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setWriteListener(WriteListener writeListener) {
+ // no-op
+ }
}
diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletRequest.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletRequest.java
index 9e7db1707..a6049e940 100644
--- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletRequest.java
+++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletRequest.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
+import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Locale;
@@ -34,12 +35,20 @@ import javax.portlet.PortletContext;
import javax.portlet.PortletRequest;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletSession;
+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.HttpUpgradeHandler;
+import javax.servlet.http.Part;
import static org.apache.struts2.portlet.PortletConstants.*;
@@ -71,7 +80,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getAuthType()
*/
public String getAuthType() {
@@ -80,7 +89,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getContextPath()
*/
public String getContextPath() {
@@ -89,7 +98,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -102,7 +111,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -113,7 +122,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Gets a property from the {@link PortletRequest}. Note that a
* {@link PortletRequest} is not guaranteed to map properties to headers.
- *
+ *
* @see PortletRequest#getProperty(String)
* @see javax.servlet.http.HttpServletRequest#getHeader(java.lang.String)
*/
@@ -124,7 +133,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Gets the property names from the {@link PortletRequest}. Note that a
* {@link PortletRequest} is not guaranteed to map properties to headers.
- *
+ *
* @see PortletRequest#getPropertyNames()
* @see javax.servlet.http.HttpServletRequest#getHeaderNames()
*/
@@ -136,7 +145,7 @@ public class PortletServletRequest implements HttpServletRequest {
* Gets the values for the specified property from the
* {@link PortletRequest}. Note that a {@link PortletRequest} is not
* guaranteed to map properties to headers.
- *
+ *
* @see PortletRequest#getProperties(String)
* @see HttpServletRequest#getHeaders(String)
*/
@@ -146,7 +155,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -156,7 +165,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getMethod()
*/
public String getMethod() {
@@ -170,7 +179,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getPathInfo()
*/
public String getPathInfo() {
@@ -179,7 +188,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getPathTranslated()
*/
public String getPathTranslated() {
@@ -188,7 +197,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getQueryString()
*/
public String getQueryString() {
@@ -197,7 +206,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getRemoteUser()
*/
public String getRemoteUser() {
@@ -206,7 +215,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -216,7 +225,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -226,7 +235,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getRequestedSessionId()
*/
public String getRequestedSessionId() {
@@ -237,7 +246,7 @@ public class PortletServletRequest implements HttpServletRequest {
* A {@link PortletRequest} has no servlet path. But for compatibility with
* Struts 2 components and interceptors, the action parameter on the request
* is mapped to the servlet path.
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getServletPath()
*/
public String getServletPath() {
@@ -250,16 +259,21 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Get the {@link PortletSession} as a {@link PortletHttpSession} instance.
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getSession()
*/
public HttpSession getSession() {
return new PortletHttpSession(portletRequest.getPortletSession());
}
+ @Override
+ public String changeSessionId() {
+ return null;
+ }
+
/**
* Get the {@link PortletSession} as a {@link PortletHttpSession} instance.
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getSession(boolean)
*/
public HttpSession getSession(boolean create) {
@@ -268,7 +282,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#getUserPrincipal()
*/
public Principal getUserPrincipal() {
@@ -277,7 +291,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -287,7 +301,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -297,7 +311,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -305,9 +319,39 @@ public class PortletServletRequest implements HttpServletRequest {
throw new IllegalStateException("Not allowed in a portlet");
}
+ @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 getParts() throws IOException, ServletException {
+ return null;
+ }
+
+ @Override
+ public Part getPart(String name) throws IOException, ServletException {
+ return null;
+ }
+
+ @Override
+ public T upgrade(Class handlerClass) throws IOException, ServletException {
+ return null;
+ }
+
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid()
*/
public boolean isRequestedSessionIdValid() {
@@ -316,7 +360,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.http.HttpServletRequest#isUserInRole(java.lang.String)
*/
public boolean isUserInRole(String role) {
@@ -327,7 +371,7 @@ public class PortletServletRequest implements HttpServletRequest {
* Gets an attribute value on the {@link PortletRequest}. If the attribute
* name is javax.servlet.include.servlet_path, it returns the
* same as {@link PortletServletRequest#getServletPath()}
- *
+ *
* @see javax.servlet.ServletRequest#getAttribute(java.lang.String)
*/
public Object getAttribute(String name) {
@@ -340,7 +384,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getAttributeNames()
*/
public Enumeration getAttributeNames() {
@@ -349,7 +393,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Can only be invoked in the event phase.
- *
+ *
* @see ServletRequest#getCharacterEncoding()
* @throws IllegalStateException
* If the portlet is not in the event phase.
@@ -364,7 +408,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Can only be invoked in the event phase.
- *
+ *
* @see ServletRequest#getContentLength()
* @throws IllegalStateException
* If the portlet is not in the event phase.
@@ -377,9 +421,14 @@ public class PortletServletRequest implements HttpServletRequest {
}
}
+ @Override
+ public long getContentLengthLong() {
+ return 0;
+ }
+
/**
* Can only be invoked in the event phase.
- *
+ *
* @see ServletRequest#getContentType()
* @throws IllegalStateException
* If the portlet is not in the event phase.
@@ -396,7 +445,7 @@ public class PortletServletRequest implements HttpServletRequest {
* Can only be invoked in the event phase. When invoked in the event phase,
* it will wrap the portlet's {@link InputStream} as a
* {@link PortletServletInputStream}.
- *
+ *
* @see ServletRequest#getInputStream()
* @throws IllegalStateException
* If the portlet is not in the event phase.
@@ -412,7 +461,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -425,7 +474,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -438,7 +487,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -449,9 +498,44 @@ public class PortletServletRequest implements HttpServletRequest {
throw new IllegalStateException("Not allowed in a portlet");
}
+ @Override
+ public ServletContext getServletContext() {
+ return null;
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException {
+ return null;
+ }
+
+ @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;
+ }
+
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getLocale()
*/
public Locale getLocale() {
@@ -460,7 +544,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getLocales()
*/
public Enumeration getLocales() {
@@ -469,7 +553,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getParameter(java.lang.String)
*/
public String getParameter(String name) {
@@ -485,7 +569,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getParameterMap()
*/
public Map getParameterMap() {
@@ -494,7 +578,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getParameterNames()
*/
public Enumeration getParameterNames() {
@@ -503,7 +587,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getParameterValues(java.lang.String)
*/
public String[] getParameterValues(String name) {
@@ -512,7 +596,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -525,7 +609,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Can only be invoked in the event phase.
- *
+ *
* @see ServletRequest#getReader()
* @throws IllegalStateException
* If the portlet is not in the event phase.
@@ -540,7 +624,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getRealPath(java.lang.String)
*/
public String getRealPath(String path) {
@@ -549,7 +633,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -562,7 +646,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -575,7 +659,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -589,7 +673,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Get the {@link PortletRequestDispatcher} as a
* {@link PortletServletRequestDispatcher} instance.
- *
+ *
* @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String)
*/
public RequestDispatcher getRequestDispatcher(String path) {
@@ -599,7 +683,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getScheme()
*/
public String getScheme() {
@@ -608,7 +692,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#getServerName()
*/
public String getServerName() {
@@ -617,7 +701,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Not allowed in a portlet.
- *
+ *
* @throws IllegalStateException
* Not allowed in a portlet.
*/
@@ -630,7 +714,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#isSecure()
*/
public boolean isSecure() {
@@ -639,7 +723,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#removeAttribute(java.lang.String)
*/
public void removeAttribute(String name) {
@@ -648,7 +732,7 @@ public class PortletServletRequest implements HttpServletRequest {
/*
* (non-Javadoc)
- *
+ *
* @see javax.servlet.ServletRequest#setAttribute(java.lang.String,
* java.lang.Object)
*/
@@ -658,7 +742,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Can only be invoked in the event phase.
- *
+ *
* @see ServletRequest#setCharacterEncoding(String)
* @throws IllegalStateException
* If the portlet is not in the event phase.
@@ -674,7 +758,7 @@ public class PortletServletRequest implements HttpServletRequest {
/**
* Get the wrapped {@link PortletRequest} instance.
- *
+ *
* @return The wrapped {@link PortletRequest} instance.
*/
public PortletRequest getPortletRequest() {
diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletResponse.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletResponse.java
index e14b347f0..e5c76f9ab 100644
--- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletResponse.java
+++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletResponse.java
@@ -20,6 +20,7 @@ package org.apache.struts2.portlet.servlet;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.Collection;
import java.util.Locale;
import javax.portlet.PortletResponse;
@@ -31,11 +32,11 @@ import javax.servlet.http.HttpServletResponse;
public class PortletServletResponse implements HttpServletResponse {
protected PortletResponse portletResponse;
-
+
public PortletServletResponse(PortletResponse portletResponse) {
this.portletResponse = portletResponse;
}
-
+
public void addCookie(Cookie cookie) {
throw new IllegalStateException("Not allowed in a portlet");
}
@@ -104,6 +105,26 @@ public class PortletServletResponse implements HttpServletResponse {
throw new IllegalStateException("Not allowed in a portlet");
}
+ @Override
+ public int getStatus() {
+ return 0;
+ }
+
+ @Override
+ public String getHeader(String name) {
+ return null;
+ }
+
+ @Override
+ public Collection getHeaders(String name) {
+ return null;
+ }
+
+ @Override
+ public Collection getHeaderNames() {
+ return null;
+ }
+
public void flushBuffer() throws IOException {
if(portletResponse instanceof RenderResponse) {
((RenderResponse)portletResponse).flushBuffer();
@@ -211,6 +232,11 @@ public class PortletServletResponse implements HttpServletResponse {
throw new IllegalStateException("Not allowed in a portlet");
}
+ @Override
+ public void setContentLengthLong(long len) {
+
+ }
+
public void setContentType(String type) {
if(portletResponse instanceof RenderResponse) {
((RenderResponse)portletResponse).setContentType(type);
diff --git a/plugins/rest/pom.xml b/plugins/rest/pom.xml
index 73efaff36..aa649b5ac 100644
--- a/plugins/rest/pom.xml
+++ b/plugins/rest/pom.xml
@@ -96,16 +96,6 @@
assertj-core
test
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
diff --git a/plugins/spring/pom.xml b/plugins/spring/pom.xml
index 087c3b398..8ac635eb6 100644
--- a/plugins/spring/pom.xml
+++ b/plugins/spring/pom.xml
@@ -19,7 +19,8 @@
* under the License.
*/
-->
-
+
4.0.0
org.apache.struts
@@ -51,13 +52,13 @@
org.springframework
spring-web
-
+
org.springframework
spring-aspects
true
-
+
org.springframework
spring-aop
@@ -80,30 +81,21 @@
commons-jci-fam
true
-
+
org.springframework
spring-context-support
true
-
+
org.easymock
easymock
test
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
+
- UTF-8
+ UTF-8
diff --git a/plugins/testng/pom.xml b/plugins/testng/pom.xml
index 78aad4319..74dd9d305 100644
--- a/plugins/testng/pom.xml
+++ b/plugins/testng/pom.xml
@@ -19,7 +19,8 @@
* under the License.
*/
-->
-
+
4.0.0
org.apache.struts
@@ -51,18 +52,10 @@
jsp-api
provided
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
+
- UTF-8
+ UTF-8
+
diff --git a/plugins/velocity/pom.xml b/plugins/velocity/pom.xml
index 8a2c69a80..a14561f24 100644
--- a/plugins/velocity/pom.xml
+++ b/plugins/velocity/pom.xml
@@ -51,7 +51,7 @@
javax.servlet
- servlet-api
+ javax.servlet-api
@@ -59,15 +59,6 @@
jsp-api
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
mockobjects
mockobjects-core
diff --git a/pom.xml b/pom.xml
index e767d3676..0029f5128 100644
--- a/pom.xml
+++ b/pom.xml
@@ -809,8 +809,8 @@
javax.servlet
- servlet-api
- 2.5
+ javax.servlet-api
+ 3.1.0
provided