aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-06-18 21:22:09 +0300
committerArtur Signell <artur@vaadin.com>2013-06-24 22:11:26 +0300
commit15c9eb5b393ec08aa9b3be849dfb394916cd5535 (patch)
tree7ed53bfc1a2039799731d2c5b9310bf6f4c91e69
parente6cfd3ae001bc870a1480ef9e9c729e1b11fe5ef (diff)
downloadvaadin-framework-15c9eb5b393ec08aa9b3be849dfb394916cd5535.tar.gz
vaadin-framework-15c9eb5b393ec08aa9b3be849dfb394916cd5535.zip
Enable using @Stylesheet with vaadin:// (#9934)
Change-Id: I895fad31ef5b31a395cea95e64d6b183d718056f
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java8
-rw-r--r--server/src/com/vaadin/annotations/StyleSheet.java5
-rw-r--r--shared/src/com/vaadin/shared/ApplicationConstants.java1
3 files changed, 14 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index d873cc8dc6..236417f23b 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -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;
}
diff --git a/server/src/com/vaadin/annotations/StyleSheet.java b/server/src/com/vaadin/annotations/StyleSheet.java
index e06140fcd5..2e15d9481c 100644
--- a/server/src/com/vaadin/annotations/StyleSheet.java
+++ b/server/src/com/vaadin/annotations/StyleSheet.java
@@ -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
diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java
index 15b81cd9a4..d7de435735 100644
--- a/shared/src/com/vaadin/shared/ApplicationConstants.java
+++ b/shared/src/com/vaadin/shared/ApplicationConstants.java
@@ -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
+ "://";