Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoristvansajtos2016-03-29 10:25:16 +0000
committerRaymond Auge2016-05-13 15:27:20 +0000
commit1593ffc5311c0257888cb9272ffb05f075eee717 (patch)
treede6bf4f9be2c18b4b16e42f54e2d64e930445455 /bundles/org.eclipse.equinox.http.servlet
parent364fa1fcdf3a202e7df3209024249e461af0183f (diff)
downloadrt.equinox.bundles-1593ffc5311c0257888cb9272ffb05f075eee717.tar.gz
rt.equinox.bundles-1593ffc5311c0257888cb9272ffb05f075eee717.tar.xz
rt.equinox.bundles-1593ffc5311c0257888cb9272ffb05f075eee717.zip
Bug 490608 - [http servlet] Ignore status code and header change attempts for include dispatch
Signed-off-by: Istvan Sajtos <istvan.sajtos@liferay.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.http.servlet')
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java18
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/IncludeDispatchResponseWrapper.java116
2 files changed, 132 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java
index 3fc8e1ec..f9851225 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Raymond Augé <raymond.auge@liferay.com> - Bug 436698
+ * Istvan Sajtos <istvan.sajtos@liferay.com> - Bug 490608
******************************************************************************/
package org.eclipse.equinox.http.servlet.internal.context;
@@ -15,8 +16,7 @@ import java.io.*;
import java.net.URLDecoder;
import java.util.*;
import javax.servlet.*;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.*;
import org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration;
import org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration;
import org.eclipse.equinox.http.servlet.internal.servlet.*;
@@ -119,6 +119,20 @@ public class DispatchTargets {
requestWrapper.push(this);
+ if (dispatcherType == DispatcherType.INCLUDE) {
+ HttpServletResponse previous = null;
+ HttpServletResponse next = response;
+
+ while (next instanceof HttpServletResponseWrapper) {
+ previous = next;
+ next = (HttpServletResponse) ((HttpServletResponseWrapper) next).getResponse();
+ }
+
+ IncludeDispatchResponseWrapper includeResponse = new IncludeDispatchResponseWrapper(next);
+
+ ((HttpServletResponseWrapper) previous).setResponse(includeResponse);
+ }
+
ResponseStateHandler responseStateHandler = new ResponseStateHandler(request, response, this);
responseStateHandler.processRequest();
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/IncludeDispatchResponseWrapper.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/IncludeDispatchResponseWrapper.java
new file mode 100644
index 00000000..4d95642f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/IncludeDispatchResponseWrapper.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Raymond Augé and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Istvan Sajtos <istvan.sajtos@liferay.com> - Bug 490608
+ ******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal.servlet;
+
+import java.util.Locale;
+import javax.servlet.http.*;
+
+/**
+ * @author Istvan Sajtos
+ */
+public class IncludeDispatchResponseWrapper extends HttpServletResponseWrapper {
+
+ public IncludeDispatchResponseWrapper(HttpServletResponse response) {
+ super(response);
+ }
+
+ @Override
+ public void addCookie(Cookie cookie) {
+ return;
+ }
+
+ @Override
+ public void addDateHeader(String name, long date) {
+ return;
+ }
+
+ @Override
+ public void addHeader(String name, String value) {
+ return;
+ }
+
+ @Override
+ public void addIntHeader(String name, int value) {
+ return;
+ }
+
+ @Override
+ public void sendError(int sc) {
+ return;
+ }
+
+ @Override
+ public void sendError(int sc, String msg) {
+ return;
+ }
+
+ @Override
+ public void sendRedirect(String location) {
+ return;
+ }
+
+ @Override
+ public void setCharacterEncoding(String charset) {
+ return;
+ }
+
+ @Override
+ public void setContentLength(int len) {
+ return;
+ }
+
+ @Override
+ public void setContentType(String type) {
+ return;
+ }
+
+ @Override
+ public void setDateHeader(String name, long date) {
+ return;
+ }
+
+ @Override
+ public void setHeader(String name, String value) {
+ return;
+ }
+
+ @Override
+ public void setIntHeader(String name, int value) {
+ return;
+ }
+
+ @Override
+ public void setLocale(Locale loc) {
+ return;
+ }
+
+ @Override
+ public void setStatus(int sc, String sm) {
+ return;
+ }
+
+ @Override
+ public void setStatus(int sc) {
+ return;
+ }
+
+ @Override
+ public void reset() {
+ return;
+ }
+
+ @Override
+ public void setBufferSize(int size) {
+ return;
+ }
+
+} \ No newline at end of file

Back to the top