I used to FileResource to add source for embeded a image and now I want to get url of that image. I have to use FileResource, not ExternalResource. Anybody can help me? tks
I can only come up with one bad way of achieving this, and that’s to use the deprecated getRelativeLocation method in Application with all its gotchas:
- The method is deprecated and might thus disappear in an upcoming release without any warnings. (I’m currently working on related code for Vaadin 7, and it seems likely the mechanism will be redesigned before Vaadin 7.0.0)
- It gives a special app:// URL in servlet environments. This URL is relative to the context path of the application and will be resolved by the client-side code using it’s information about how the application is actually accessed (e.g. proxying through front-end servers might change the actual URL to something that the servlet container can’t know about).
- The method returns an absolute URL in Portlet environments, but it only works from a thread processing a Portlet request - calling it from a background thread will just return null.