Resources and version 6.7

I recently tried to update one of my vaadin base projects to version 6.7.0.
This action broke my application in regards to the use of resources.

I have managed to work around my problem with opening child resource window by removing special characters form the document name.

	public void openResourceWindow(final byte[] bytes, String docName, MyMimeType mimeType) {
	//	docName += DateTools.toDateString(new Date(), "yyyy/MM/dd HH:mm:ss");
		docName += DateTools.toDateString(new Date(), "-yyyyMMdd-HHmmss") + mimeType.getFileExt();
		StreamSource stream = new StreamSource() {
			private static final long serialVersionUID = 1L;
			public InputStream getStream() {
				return new ByteArrayInputStream(bytes);
		StreamResource resource = new StreamResource(stream, docName, (Application)this);
		getMainWindow().open(resource, "_new");

I am however still struggling with a my application images. The cleaned up code snippet is as follows:

ClassResource source = new ClassResource("/images/logo.jpg", app);
pTitleBar.addComponent(new Embedded(null, source));

I have tried to track the request for the embedded resource, but to date I have not been able to locate the right place to set the breakpoint so I can workout what I could be doing differently.

My guess is this has something to do with the resent security enhancements.
I am looking for suggested solutions for accessing image resource from my application WAR file (that are not part of the a “theme”)?
P.S. The application worked with version 6.6.5 - 6.6.8

FYI. I have managed to work out a work around to the original problem by introducing another layer of complexity.

		Component logo = null;
		try {
			StreamSource stream = new StreamSource() {
				private static final long serialVersionUID = 1L;

				public InputStream getStream() {
					ClassResource source = new ClassResource(
							"/images/logo.jpg", app);
					ByteArrayOutputStream outStream = new ByteArrayOutputStream(0);
					InputStream inStream = source.getStream().getStream();
					for (;;) {
						byte[] bytes = new byte[1024]
						try {
							int cnt =;
							if (cnt <= 0)
						} catch (IOException e1) {
							// TODO Auto-generated catch block
						try {
						} catch (IOException e) {
							// TODO Auto-generated catch block

					return new ByteArrayInputStream(outStream.toByteArray());
			StreamResource resource = new StreamResource(stream, "logo.jpg", app);
			logo = new Embedded(null, resource);

This (to me) highlights that both the ClassResource and Emebbed classes basically still work, just that recent rework of Vaadin prevents them from working directly with each other.

Yes, this was related to the security fixes, and only applies to certain servlet containers.

Could you try with the latest 6.7 nightly build? That should fix the problem. Vaadin 6.7.1 should also be out soon.

And to continue on this… you can either place the images under the VAADIN directory and let the Vaadin servlet serve them, or handle them explicitly with Resource instances you create. Creating your own Resource class based on the standard ones might be a good option in some cases.
You could also serve them with something else than the VAADIN servlet if you want them to be available at another path, but then you might need to handle context paths in references to them etc. yourself.

I have tried the 6.7.0 and 6.7.1 nightly builds.The 6.7.0 did not fix my problem, but the version 6.7.1 did.

FYI. I Also in 6.7.0 I have a situation with a field on a view being updated (coded as below) not updating in the browser view.

Property p = model.getItemProperty(ReportJPA._FILENAME);

This is only a problem in version 6.7.0. Version 6.6.* and 6.7.1 (atleast nightly-20111012-c21688) work for as expected.
For now I am going to return to using 6.6.8, while waiting patiently for 6.7.1.

Many Thanks.

I hope we don’t have to be too patient for a 6.7.1 release. It seems that 6.7.0 has many issues and an official 6.7.1 should come out soon, if anything to avoid the issues 6.7.0 introduced. So far I’m happy with the nightly builds for fixing the various issues we had. Looking forward to it! :slight_smile: