An existential question about the way I use to get dynamic data

Hello,

I’m writing an article on creating a Groovy/Vaadin portlet (implemented in an external script) deployed on Liferay 6, and that portlet uses a Flash chart.
I must pass a parameter for the Flash object that is an URL in order to get the chart data (in XML document in my case) that is built by my Vaadin portlet.
All works well, but I ask me one question if I use the proper way to get the data.

To determine the URL I use this Groovy code:

def dataUrl = ctx.generateApplicationResourceURL(
			new FileResource(new File("data"), application), "dataUrl")

Here ctx is of type PortletApplicationContext2.

And I defined an URIHandler in order to return the XML document:

mainWindow.addURIHandler(new URIHandler() {		
            public DownloadStream handleURI(URL context, String relativeUri) {
            // ...
            }
}

So, here my question: as I use a FileResource object with a File object, it is like I used a file that does not really exist. Is it a valid way to do such thing? Or is there another way?

Thank you!

Bertrand.