]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #6772: Application resources and stream variables now relatively parsed on...
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 6 Apr 2011 09:43:35 +0000 (09:43 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 6 Apr 2011 09:43:35 +0000 (09:43 +0000)
svn changeset:18126/svn branch:6.5

src/com/vaadin/terminal/PaintTarget.java
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/client/ui/VUpload.java
src/com/vaadin/terminal/gwt/server/CommunicationManager.java
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java

index a81c637de2b87265d9fd9c8b234d420f7022e801..d118562588e2c07337cf3914144d7867d6040bc3 100644 (file)
@@ -8,6 +8,7 @@ import java.io.Serializable;
 import java.util.Map;
 
 import com.vaadin.terminal.StreamVariable.StreamingStartEvent;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
 
 /**
  * This interface defines the methods for painting XML to the UIDL stream.
@@ -158,6 +159,10 @@ public interface PaintTarget extends Serializable {
      * terminals Receivers are typically rendered for the client side as URLs,
      * where the client side implementation can do an http post request.
      * <p>
+     * The urls in UIDL message may use Vaadin specific protocol. Before
+     * actually using the urls on the client side, they should be passed via
+     * {@link ApplicationConnection#translateVaadinUri(String)}.
+     * <p>
      * Note that in current terminal implementation StreamVariables are cleaned
      * from the terminal only when:
      * <ul>
index a8b1909dab7fc803c8d91d359574ee9718549ced..b0cf4945f0255988831175312372221e951804fd 100755 (executable)
@@ -2142,6 +2142,9 @@ public class ApplicationConnection {
             }
             uidlUri = themeUri + uidlUri.substring(7);
         }
+        if (uidlUri.startsWith("app://")) {
+            uidlUri = getAppUri() + uidlUri.substring(6);
+        }
         return uidlUri;
     }
 
index f267f9786094c38bcfeb5c98ae94b33d8ab8b204..dc9b5ba5455a3e3aa05653460cd78c6a4b2f4a05 100644 (file)
@@ -147,7 +147,9 @@ public class VUpload extends SimplePanel implements Paintable {
         this.client = client;
         paintableId = uidl.getId();
         nextUploadId = uidl.getIntAttribute("nextid");
-        element.setAction(uidl.getStringVariable("action"));
+        final String action = client.translateVaadinUri(uidl
+                .getStringVariable("action"));
+        element.setAction(action);
         submitButton.setText(uidl.getStringAttribute("buttoncaption"));
         fu.setName(paintableId + "_file");
 
index 111f43b31f54411d96ab0d4d0af73a6fa04d6781..5851621a2097051134f4867c621457cecd8a839a 100644 (file)
@@ -396,9 +396,8 @@ public class CommunicationManager extends AbstractCommunicationManager {
             streamVariableToSeckey.put(value, seckey);
         }
 
-        return getApplication().getURL()
-                + AbstractApplicationServlet.UPLOAD_URL_PREFIX + key + "/"
-                + seckey;
+        return "app://" + AbstractApplicationServlet.UPLOAD_URL_PREFIX + key
+                + "/" + seckey;
 
     }
 
index 8c8ab1e1be0a5c449ba2152459a3642dc0ddd79a..080ff33af53ae2a89cb265a21f1506b2861cef88 100644 (file)
@@ -371,16 +371,7 @@ public class JsonPaintTarget implements PaintTarget {
                         "Application not specified for resorce "
                                 + value.getClass().getName());
             }
-            String uri;
-            if (a.getURL() != null) {
-                uri = a.getURL().getPath();
-            } else {
-                uri = "";
-            }
-            if (uri.length() > 0 && uri.charAt(uri.length() - 1) != '/') {
-                uri += "/";
-            }
-            uri += a.getRelativeLocation(r);
+            final String uri = "app://" + a.getRelativeLocation(r);
             addAttribute(name, uri);
 
         } else if (value instanceof ThemeResource) {