Image resources not shown

Hi

I had an old Vaadin application (6.3.x) and I decided today to update it to 6.5.4. I had a button with an image icon. It doesn’t show after upgrade. It’s a web app, not a portlet. The environment is maven with all the plugins and dependencies.

I included the image as an Embedded and I’ve tried to load it as a ClassResource and as an ExternalResource. Nothing. The image is not downloaded to the browser. They are in the deployed applications folder.

I put it in the maven resources folder (deployed to WEB-INF/classes) and ClassResource(“myimage.jpg”,this);
I put it in a package and ClassResource(“/my/package/myimage.jpg”,this);
I put it in an images folder with this app deployed in context /Control2 as ExternalResource(“/Control2/images/myimage.jpg”);
And just in case it would work as ExternalResource(“images/myimage.jpg”);

Nothing. Neither with firefox nor with IE.

And it seems I’m not the only one who is having issues with resources.

Any ideas?

BTW, recompiling all the widgetsets at every maven run is a complete waste of time.

Hi,

I don’t know directly what could have changed between the Vaadin versions. It is possible that something.

In the first case, I think you also need the leading slash, i.e., ClassResource(“/myimage.jpg”,this);

The second case should work, I think. See
here
.

If you use an ExternalResource to a local file, the file must not be in the application’s path. For example, if your app path is “/Control2/” (url-pattern is /), you can’t put your images in “/Control2/images”, because such paths are mapped to the servlet. Instead, you must map your application to “/Control2/app” with url-pattern /app/ (and also the /VAADIN/* path). See
here
for an example. (KB:
#159
).

If I remember correctly, the Vaadin Maven plugin doesn’t compile the widget sets every time, but it does it too often nevertheless.

I’m trying to find a few moments to work on the Maven archetypes.

If the GWT plugin is integrated to a build phase in the normal way, there does not seem to be any way to configure it not to recompile the widgetset(s) aggressively when there are source code changes.

However, what can be done is to move it and the vaadin-maven-plugin out of the section to the section. The advantage - and disadvantage - is that this way, there is no automatic build of the widgetset, so you always need to do it explicitly. With that configuration, you cannot just say “mvn clean install” and have an intact package installed, but you need to use “mvn clean compile vaadin:update-widgetset gwt:compile install”.

Another alternative is to use a Maven multi-module project where one module is the client side and the server side module depends on it.

Hi

It worked using ClassResource("/myimage…).

It seems I missed the leading slash, but I think I tried it also.

Thanks