StreamLink

Description

Produces a direct link into a resource, which can be streamed as raw data with a content type and content disposition.

The link is perfect to use if you have some data that you would like to make available as a download as the content type is defined by the associated streamresource.

The obvious use of the StreamLink is when you would like to export a PDF or some csv file, but the StreamService that the StreamLink uses, can stream any kind of data. See also StreamAsset

Parameters

Name Type Required Default Description
parameters Object or

Object[] or

List
no Parameters passed to the defined streamresource. The parameters can be retrieved from the RequestCycle much like in a listener method. See: example below.
streamResourceSourceExtentionName java.lang.String no literal:resourcesource The name of the StreamResourceSource extention the StreamService should use to fetch stream data.

The name will be prefixed: 'bayeux.stream'.

Ex: The StreamResourceSource extention defined in your <servlet-name>.application file could be named 'bayeux.stream.mystream' where 'mystream' is given as value to this parameter.
disabled boolean no false Controls whether the link is produced. If disabled, the portion of the template the link surrounds is still rendered, but not the link itself.
stateful boolean no true If true (the default), then the component requires an active (i.e., non-new) HttpSession when triggered. Failing that, it throws a StaleLinkException . If false, then no check is necessary. The latter works well with links that encode all necessary state inside the URL itself.
target String no The name of the html target for this link, this is just the normal html attribute that will control where the response generated from this link will go. (Usually used in frames)
scheme String no The required scheme ("http" or "https", typically) for the URL. This will force the creation of an absolute URL when the current request's scheme does not match the value for this parameter. This is most often used to switch to "https" for secure portions of an application (such as a login page), before switching back to standard "http" for the majority of an application.
port Integer no The required port (80, 443, 8080. 8443, typically) for the URL. This will force the creation of an absolute URL when the current request's scheme does not match the value for this parameter. This is most often used in conjunction with scheme to switch to "https:443"/"https:8443" for secure portions of an application (such as a login page), before switching back to standard "http:80"/"http:80" for the majority of an application.
renderer ILinkRenderer no The object which will actually render the link.

Further info

  • Body: Rendered
  • Informal parameters: Allowed
  • Reserved parameters: href

Requirements

This component uses the StreamService service which in turn requires specific configuration of a stream resource source. Please refer to the service for configuration of that thingi.

Example

Presuming you have defined bayeux library in you application under the library name "bayeux":
                    <a href="#" jwcid="@bayeux:StreamLink" parameters="ognl:parameters">Stream 123 resource</a>
                
or define a specific StreamResourceSource to use:
                    <a href="#" jwcid="@bayeux:StreamLink" parameters="ognl:parameters"
                    streamResourceSourceExtentionName="literal:differentstreamsource">Stream 123 resource</a>