aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt/server/ResourceReference.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-13 18:34:33 +0300
committerArtur Signell <artur@vaadin.com>2012-08-13 19:18:33 +0300
commite85d933b25cc3c5cc85eb7eb4b13b950fd8e1569 (patch)
tree9ab6f13f7188cab44bbd979b1cf620f15328a03f /src/com/vaadin/terminal/gwt/server/ResourceReference.java
parent14dd4d0b28c76eb994b181a4570f3adec53342e6 (diff)
downloadvaadin-framework-e85d933b25cc3c5cc85eb7eb4b13b950fd8e1569.tar.gz
vaadin-framework-e85d933b25cc3c5cc85eb7eb4b13b950fd8e1569.zip
Moved server files to a server src folder (#9299)
Diffstat (limited to 'src/com/vaadin/terminal/gwt/server/ResourceReference.java')
-rw-r--r--src/com/vaadin/terminal/gwt/server/ResourceReference.java67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/ResourceReference.java b/src/com/vaadin/terminal/gwt/server/ResourceReference.java
deleted file mode 100644
index 2104ad4b87..0000000000
--- a/src/com/vaadin/terminal/gwt/server/ResourceReference.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.server;
-
-import com.vaadin.Application;
-import com.vaadin.shared.communication.URLReference;
-import com.vaadin.terminal.ApplicationResource;
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.terminal.Resource;
-import com.vaadin.terminal.ThemeResource;
-
-public class ResourceReference extends URLReference {
-
- private Resource resource;
-
- public ResourceReference(Resource resource) {
- this.resource = resource;
- }
-
- public Resource getResource() {
- return resource;
- }
-
- @Override
- public String getURL() {
- if (resource instanceof ExternalResource) {
- return ((ExternalResource) resource).getURL();
- } else if (resource instanceof ApplicationResource) {
- final ApplicationResource r = (ApplicationResource) resource;
- final Application a = r.getApplication();
- if (a == null) {
- throw new RuntimeException(
- "An ApplicationResource ("
- + r.getClass().getName()
- + " must be attached to an application when it is sent to the client.");
- }
- final String uri = a.getRelativeLocation(r);
- return uri;
- } else if (resource instanceof ThemeResource) {
- final String uri = "theme://"
- + ((ThemeResource) resource).getResourceId();
- return uri;
- } else {
- throw new RuntimeException(getClass().getSimpleName()
- + " does not support resources of type: "
- + resource.getClass().getName());
- }
-
- }
-
- public static ResourceReference create(Resource resource) {
- if (resource == null) {
- return null;
- } else {
- return new ResourceReference(resource);
- }
- }
-
- public static Resource getResource(URLReference reference) {
- if (reference == null) {
- return null;
- }
- assert reference instanceof ResourceReference;
- return ((ResourceReference) reference).getResource();
- }
-}