From 7411bd0456f6dca3f8c25a5050ea786f90c6af0f Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 30 Aug 2012 13:05:19 +0300 Subject: Refactor to enable implementing #7545 without changing the API --- server/src/com/vaadin/server/AbstractClientConnector.java | 2 +- server/src/com/vaadin/server/DownloadStream.java | 7 +++++-- server/src/com/vaadin/server/GlobalResourceHandler.java | 2 +- server/src/com/vaadin/ui/AbstractMedia.java | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'server/src') diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index fa127fa2aa..2f660a443d 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -572,7 +572,7 @@ public abstract class AbstractClientConnector implements ClientConnector { ConnectorResource resource = (ConnectorResource) getResource(key); if (resource != null) { DownloadStream stream = resource.getStream(); - stream.writeTo(response); + stream.writeResponse(request, response); return true; } else { return false; diff --git a/server/src/com/vaadin/server/DownloadStream.java b/server/src/com/vaadin/server/DownloadStream.java index 7bc8a17c03..0c00f96832 100644 --- a/server/src/com/vaadin/server/DownloadStream.java +++ b/server/src/com/vaadin/server/DownloadStream.java @@ -26,7 +26,6 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; - /** * Downloadable stream. * @@ -231,14 +230,18 @@ public class DownloadStream implements Serializable { * redirect (302 Moved temporarily) is sent instead of the contents of this * stream. * + * @param request + * the request for which the response should be written * @param response * the wrapped response to write this download stream to + * * @throws IOException * passed through from the wrapped response * * @since 7.0 */ - public void writeTo(WrappedResponse response) throws IOException { + public void writeResponse(WrappedRequest request, WrappedResponse response) + throws IOException { if (getParameter("Location") != null) { response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); response.setHeader("Location", getParameter("Location")); diff --git a/server/src/com/vaadin/server/GlobalResourceHandler.java b/server/src/com/vaadin/server/GlobalResourceHandler.java index 7038d51251..f3a72a0efc 100644 --- a/server/src/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/com/vaadin/server/GlobalResourceHandler.java @@ -116,7 +116,7 @@ public class GlobalResourceHandler implements RequestHandler { + " didn't produce any stream."); } - stream.writeTo(response); + stream.writeResponse(request, response); return true; } diff --git a/server/src/com/vaadin/ui/AbstractMedia.java b/server/src/com/vaadin/ui/AbstractMedia.java index 940d85a8b9..3f59b070b7 100644 --- a/server/src/com/vaadin/ui/AbstractMedia.java +++ b/server/src/com/vaadin/ui/AbstractMedia.java @@ -97,7 +97,7 @@ public abstract class AbstractMedia extends AbstractComponent { URLReference reference = sources.get(sourceIndex); ConnectorResource resource = (ConnectorResource) ResourceReference .getResource(reference); - resource.getStream().writeTo(response); + resource.getStream().writeResponse(request, response); return true; } else { return super.handleConnectorRequest(request, response, path); -- cgit v1.2.3