]> source.dussan.org Git - vaadin-framework.git/commitdiff
Enable using @Stylesheet with vaadin:// (#9934)
authorArtur Signell <artur@vaadin.com>
Tue, 18 Jun 2013 18:22:09 +0000 (21:22 +0300)
committerArtur Signell <artur@vaadin.com>
Tue, 18 Jun 2013 18:41:57 +0000 (21:41 +0300)
Change-Id: I895fad31ef5b31a395cea95e64d6b183d718056f

client/src/com/vaadin/client/ApplicationConnection.java
server/src/com/vaadin/annotations/StyleSheet.java
shared/src/com/vaadin/shared/ApplicationConstants.java

index d873cc8dc62ca11147039ef58ee19aa99d9d0f30..236417f23b783f72abaae58c3f94095c23954b53 100644 (file)
@@ -2940,6 +2940,14 @@ public class ApplicationConnection {
                 uidlUri = serviceUrl + relativeUrl;
             }
         }
+        if (uidlUri.startsWith(ApplicationConstants.VAADIN_PROTOCOL_PREFIX)) {
+            final String vaadinUri = configuration.getVaadinDirUrl();
+            String relativeUrl = uidlUri
+                    .substring(ApplicationConstants.VAADIN_PROTOCOL_PREFIX
+                            .length());
+            uidlUri = vaadinUri + relativeUrl;
+        }
+
         return uidlUri;
     }
 
index e06140fcd519da1c190221666c147ef235f9a5ea..2e15d9481c5ab3ecaa69c2f5dc22111537326c1d 100644 (file)
@@ -32,6 +32,11 @@ import com.vaadin.server.ClientConnector;
  * Relative urls are mapped to APP/PUBLISHED/[url] which are by default served
  * from the classpath relative to the class where the annotation is defined.
  * <p>
+ * Special Vaadin urls are also supported. The most useful is vaadin:// which
+ * maps to the location of the automatically published VAADIN folder. Using the
+ * VAADIN folder and vaadin:// you can publish stylesheets which use images or
+ * other files with relative paths.
+ * <p>
  * Example: {@code @StyleSheet( "http://host.com/file1.css", "file2.css"})} on
  * the class com.example.MyConnector would load the file
  * http://host.com/file1.css as is and file2.css from /com/example/file2.css on
index 15b81cd9a47b1b25e256ec60738b5ed8c87b5ca9..d7de435735487fe497f88d99744f6d52f7e69825 100644 (file)
@@ -34,6 +34,7 @@ public class ApplicationConstants implements Serializable {
             + "PUBLISHED";
 
     public static final String APP_PROTOCOL_PREFIX = "app://";
+    public static final String VAADIN_PROTOCOL_PREFIX = "vaadin://";
     public static final String PUBLISHED_PROTOCOL_NAME = "published";
     public static final String PUBLISHED_PROTOCOL_PREFIX = PUBLISHED_PROTOCOL_NAME
             + "://";