Acts together with the StreamLink component and StreamAsset by dispatcing requests from links produced by StreamLinks and StreamAssets to an implementation of StreamResourceSource . Stream resources resolved like this are streamed direct to client with the specified content type and content disposition.
This service is perfect for downloading/streaming pdf files, images, csv files or other resources, as the content disposition can be set for the browser to act upon it.
This service needs to have somewhere to lookup the resources that can be streamed. Each incoming link to this service can have parameters, which is passed on to an extension implementing StreamResourceSource . These parameters can be used to look up the resource to stream.
In the Tapestry application which uses this service you must define an extension like this:
<extension name="bayeux.stream.resourcesource" class="com.foo.bar.YourImplementationOfStreamResourceSource"/>
Where the "com.foo.bar.YourImplementationOfStreamResourceSource" is a class of your application which implements the StreamResourceSource interface.
Tapestry bayeux comes with a abstract default implementation of the
StreamResourceSource
inteface.
The default implementation requires a InputStream getResourceAsStream() method to be implemented.
(just as the deprecated DownloadResourceSource did) but handles the writing to the outout stream.
In many cases this is what is needed.
Note: For your stream extentions to be seen you have to prefix it with ' bayeux.stream '. like this:
<extension name="bayeux.stream.<your-extention-name>" class="com.foo.bar.YourImplementationOfStreamResourceSource"/>
<inject property="streamService" object="service:com.nordija.tapestry.bayeux.StreamService"/>