Absolute path of a ThemeResource...

Hi all,

Is there a way of obtaining the absolute path of a ThemeResource…??
I have a ThemeResource as follows.
I’m only able to get the relative path of it (images/next.png) & unable to get the absolute path at all.

ThemeResource nextIcon = new ThemeResource("images/next.png");

Any help is greatly appreciated.
Thanks in advance,
Asela.

Something like this could work:

getApplication().getContext().getBaseDirectory() + "/VAADIN/themes/" + getApplication().getTheme() + "/" + nextIcon.getResourceId()

This one will give the absolute path of the event

[quote]
String basepath = getApplication().getContext().getBaseDirectory().getAbsolutePath();
[/quote]:blink:

what about this in Vaadin 7?! isn’t this just for 6?

In Vaadin 7 - the only way I’ve found so far

String path = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath() + "/VAADIN/themes/mytheme";

And how can I get the Path from the resources folder?

See attchahment

21087.png

If you want to host your resources on a different server, as in https://vaadin.com/blog/-/blogs/optimizing-hosting-setup , try this approach:

String path = VaadinService.getCurrent().getDeploymentConfiguration().getResourcesPath() + "/VAADIN/themes/" + UI.getCurrent().getTheme() + "/" + specificResourcePath;