summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2013-04-08 10:10:32 +0300
committerHenri Sara <hesara@vaadin.com>2013-04-08 10:10:32 +0300
commitc0bf2608dd23051f11f2a031e08aebbfdf7b5472 (patch)
tree5432bd7b9fe2f69431c504b9603878622e45be8c
parent2b5f6ccc1e9ae5c9c8c88dc3195020eaa27a3be6 (diff)
downloadvaadin-framework-c0bf2608dd23051f11f2a031e08aebbfdf7b5472.tar.gz
vaadin-framework-c0bf2608dd23051f11f2a031e08aebbfdf7b5472.zip
Remove resource related code from VaadinPortlet (#11527)
Change-Id: I33f489922bab432d1d85f4d46b73df8bd89ae91c Merge: no
-rw-r--r--server/src/com/vaadin/server/VaadinPortlet.java33
1 files changed, 3 insertions, 30 deletions
diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java
index b4a2390fa5..7d4618d58e 100644
--- a/server/src/com/vaadin/server/VaadinPortlet.java
+++ b/server/src/com/vaadin/server/VaadinPortlet.java
@@ -17,7 +17,6 @@ package com.vaadin.server;
import java.io.BufferedWriter;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
@@ -28,7 +27,6 @@ import java.security.GeneralSecurityException;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
-import java.util.logging.Level;
import java.util.logging.Logger;
import javax.portlet.ActionRequest;
@@ -340,6 +338,9 @@ public class VaadinPortlet extends GenericPortlet implements Constants,
} else if (isDummyRequest(resourceRequest)) {
return RequestType.DUMMY;
} else {
+ // these are not served with ResourceRequests, but by a servlet
+ // on the portal at portlet root path (configured by default by
+ // Liferay at deployment time, similar on other portals)
return RequestType.STATIC_FILE;
}
} else if (request instanceof ActionRequest) {
@@ -406,9 +407,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants,
new BufferedWriter(new OutputStreamWriter(out, "UTF-8")));
outWriter.print("<html><body>dummy page</body></html>");
outWriter.close();
- } else if (requestType == RequestType.STATIC_FILE) {
- serveStaticResources((ResourceRequest) request,
- (ResourceResponse) response);
} else {
VaadinPortletSession vaadinSession = null;
@@ -589,31 +587,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants,
handleRequest(request, response);
}
- private void serveStaticResources(ResourceRequest request,
- ResourceResponse response) throws IOException, PortletException {
- final String resourceID = request.getResourceID();
- final PortletContext pc = getPortletContext();
-
- InputStream is = pc.getResourceAsStream(resourceID);
- if (is != null) {
- final String mimetype = pc.getMimeType(resourceID);
- if (mimetype != null) {
- response.setContentType(mimetype);
- }
- final OutputStream os = response.getPortletOutputStream();
- final byte buffer[] = new byte[DEFAULT_BUFFER_SIZE];
- int bytes;
- while ((bytes = is.read(buffer)) >= 0) {
- os.write(buffer, 0, bytes);
- }
- } else {
- getLogger().log(Level.INFO,
- "Requested resource [{0}] could not be found", resourceID);
- response.setProperty(ResourceResponse.HTTP_STATUS_CODE,
- Integer.toString(HttpServletResponse.SC_NOT_FOUND));
- }
- }
-
@Override
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {