From: Matti Tahvonen Date: Tue, 18 Jan 2011 11:40:50 +0000 (+0000) Subject: fixes #6301 X-Git-Tag: 6.7.0.beta1~491 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4e1a5db861e9e73e69fd492a55f171625f255beb;p=vaadin-framework.git fixes #6301 svn changeset:16921/svn branch:6.5 --- diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 5291870390..0808bd9125 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -1691,23 +1691,38 @@ public abstract class AbstractCommunicationManager implements // Get the path from URL String path = callback.getRequestPathInfo(request); - // If the path is specified, create name from it - if (path != null && path.length() > 0 && !path.equals("/")) { - String windowUrlName = null; - if (path.charAt(0) == '/') { - path = path.substring(1); - } - final int index = path.indexOf('/'); - if (index < 0) { - windowUrlName = path; - path = ""; - } else { - windowUrlName = path.substring(0, index); - path = path.substring(index + 1); - } + /* + * If the path is specified, create name from it. + * + * An exception is if UIDL request have come this far. This happens + * if main window is refreshed. In that case we always return main + * window (infamous hacky support for refreshes if only main window + * is used). However we are not returning with main window here (we + * will later if things work right), because the code is so cryptic + * that nobody really knows what it does. + */ + boolean pathMayContainWindowName = path != null + && path.length() > 0 && !path.equals("/"); + if (pathMayContainWindowName) { + boolean uidlRequest = path.startsWith("/UIDL"); + if (!uidlRequest) { + String windowUrlName = null; + if (path.charAt(0) == '/') { + path = path.substring(1); + } + final int index = path.indexOf('/'); + if (index < 0) { + windowUrlName = path; + path = ""; + } else { + windowUrlName = path.substring(0, index); + path = path.substring(index + 1); + } - window = application.getWindow(windowUrlName); + window = application.getWindow(windowUrlName); + } } + } // By default, use mainwindow