Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-10-08 14:12:05 +0000
committerThomas Watson2014-10-08 14:26:32 +0000
commitdc03a2df7ee5c0e2cca05ae1a194e9839ae91b0a (patch)
treefec15ce88612f885befc72553756062d6679d747
parent55bcbcc877edc933d4c7dac707c8131d532221c8 (diff)
downloadeclipse.platform.ua-I20141029-2000.tar.gz
eclipse.platform.ua-I20141029-2000.tar.xz
eclipse.platform.ua-I20141029-2000.zip
- updates to help to support servlet 3.1 Change-Id: I6a2f395c43a2e47eaf785e4f198835fd2c78706a Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java43
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java18
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java7
3 files changed, 30 insertions, 38 deletions
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java
index 30be71fce..90699e38a 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2014 IBM Corporation 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
@@ -11,7 +11,6 @@
package org.eclipse.help.internal.webapp.servlet;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -145,7 +144,6 @@ public class ValidatorServlet extends HttpServlet {
public boolean isSecure(HttpServletRequest req,HttpServletResponseAdv resp)
throws SecurityException {
-
Enumeration names = req.getParameterNames();
List values = new ArrayList();
List scripts = new ArrayList();
@@ -160,7 +158,6 @@ public class ValidatorServlet extends HttpServlet {
}
if (resp.getWriter() != null) {
-
String data = resp.getString();
for (int s=0; s < scripts.size(); s++)
if (data.indexOf((String)scripts.get(s)) > -1)
@@ -193,13 +190,11 @@ public class ValidatorServlet extends HttpServlet {
private class HttpServletResponseAdv extends HttpServletResponseWrapper {
private HttpServletResponse response;
- private ByteArrayOutputStream out;
private ServletPrintWriter writer;
- private SecureServletOutputStream stream;
+ private ServletOutputStream stream;
public HttpServletResponseAdv(HttpServletResponse response) {
super(response);
- out = new ByteArrayOutputStream();
this.response = response;
}
@@ -210,10 +205,10 @@ public class ValidatorServlet extends HttpServlet {
return writer;
}
- public ServletOutputStream getOutputStream() {
+ public ServletOutputStream getOutputStream() throws IOException {
if (stream == null && writer == null)
- stream = new SecureServletOutputStream(out);
+ stream = response.getOutputStream();
return stream;
}
@@ -221,23 +216,13 @@ public class ValidatorServlet extends HttpServlet {
OutputStream os = response.getOutputStream();
InputStream is = getInputStream();
-
- Utils.transferContent(is, os);
-
+ if (is != null) {
+ Utils.transferContent(is, os);
+ }
os.flush();
}
public InputStream getInputStream() {
-
- if (stream != null) {
-
- try {
- out.flush();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return new ByteArrayInputStream(out.toByteArray());
- }
if (writer != null) {
try {
@@ -257,18 +242,4 @@ public class ValidatorServlet extends HttpServlet {
return null;
}
}
-
-
- private class SecureServletOutputStream extends ServletOutputStream {
-
- private OutputStream out;
-
- public SecureServletOutputStream(OutputStream out) {
- this.out = out;
- }
-
- public void write(int b) throws IOException {
- out.write(b);
- }
- }
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java
index 1aea35af3..1d8aa67a7 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2014 IBM Corporation 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
@@ -33,6 +33,7 @@ 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;
/**
@@ -390,4 +391,19 @@ public class MockServletRequest implements HttpServletRequest {
return null;
}
+ public long getContentLengthLong() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String changeSessionId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java
index a31274cd7..9bddaf858 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2014 IBM Corporation 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
@@ -222,6 +222,11 @@ public class MockServletResponse implements HttpServletResponse {
// TODO Auto-generated method stub
return null;
}
+
+ public void setContentLengthLong(long len) {
+ // TODO Auto-generated method stub
+
+ }
}

Back to the top