StreamVariable with JavaScript Component

I’m writing a custom JavaScript component to wrap
but I’m having a hard time trying to figure out how to use StreamVariable. All the examples I can find are using the legacy PaintTarget and not the new State mechanism.

On the server side, I created my state object with a field:
public StreamVariable endpoint;

On the client side, in the JavaScript, I tried printing out the “endpoint” variable like:
alert(“Starting upload:” + this.getState().endpoint);

The alert indicates that “endpoint” is an object, not a URL. So two questions:

#1) how to I get the URL to this StreamVariable on the client side using the new State mechanism?
#2) once I get the URL, how do I make the recommended call to “com.vaadin.client.ApplicationConnection#translateVaadinUri(String)” to use it in JavaScript code? Is the connection exposed in the JavaScript component?


A follow-on question:
#3) Is StreamVariable still the right way to handle client uploads/posts in Vaadin 7 or does it make more sense to use a RequestHandler that is registered with the session when my custom component is attached/detached?


Hi Michael,

Did you manage to integrate plupload and vaadin?

If you could share the code I would be very glad and could even help to finish it if its unfinished.


I believe I got all the basic functionality working but I didn’t end up using it in production. There was some concern over help desk support because of the many different mechanisms used by plupload on the client side. In the end we just ended up using multiple instances of Vaadin’s upload component which works but isn’t as feature rich.

I created a repository for my code at
. I believe you should be able to use it out of the box and as a JavaScript component you shouldn’t even need to rebuild your widget set. I included an example component in there so you can see how it is used but I tried to stick pretty closely to the Plupload API.

Let me know if you find it useful. I could package it up into a true addon if there is interest.