compared with
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history

There are 2 changes. View first change.

 h2. Overview
 _Since 4.0_
 The ace:dynamicResource component serves JSF resources created by custom implementations of javax.faces.application.Resource, allowing for greater control and flexibility.
 {tip}See the ICEfaces Showcase [Live Demo|http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=dynamicResourceBean] of this component, complete with source code.{tip}
 h2. Getting Started
 To use the DynamicResource component, it is necessary to first make a custom implementation of {{javax.faces.application.Resource}}, as the basic example below. The implementation can modify the behaviour of the Resource in any way to better suit the purposes of the application.
  public class MyResource extends Resource implements java.io.Serializable {
  private String path = "";
  private HashMap<String, String> headers;
  private byte[] bytes;
  public MyResource(byte[] bytes) {
  this.bytes = bytes;
  this.headers = new HashMap<String, String>();
  public InputStream getInputStream() {
  return new ByteArrayInputStream(this.bytes);
  public String getRequestPath() {
  return path;
  public void setRequestPath(String path) {
  this.path = path;
  public Map<String, String> getResponseHeaders() {
  return headers;
  public URL getURL() {
  return null;
  public boolean userAgentNeedsUpdate(FacesContext context) {
  return false;
 Once this is done and an instance is initialized, the component is added to the page, specifying this Resource instance, as well as other attributes that specify the way the resource is delivered.
 <ace:dynamicResource id="dynamicResource"
  label="Download resource"
  fileName="MyCustomFileName.pdf" />
 h2. Attributes
 {tip:title=TagLib Documentation}This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available [here|http://res.icesoft.org/docs/v4_latest/ace/tld/ace/dynamicResource.html].{tip}
 The *resource* attribute references the instance of the Resource object to serve.
 The *type* attribute specifies if a {{link}}, {{image}}, or {{button}} is displayed to the user to activate and download the resource.
 The *label* attribute specifies the label of the link or button when the resource is presented in these ways.
 The *attachment* flag indicates whether the resource should be downloaded as an attachment, in order to force the browser to save the resource instead of trying to open it.
 The *fileName* attribute specifies the name used to save this file as, when downloading it as an attachment.
 h2. Event Listeners
 h2. Client Behavior Events
 h2. JavaScript API
 Not applicable.
 h2. Keyboard Support
 h2. CSS Classes
 This component doesn't use any default CSS class names. The custom class names and styling specified in {{styleClass}} and {{style}} are applied on the {{a}} or {{input}} element, depending on the value of the {{type}} attribute.
 h2. Known Issues
 h2. Additional Resources
 {panel}Note that if you intend to produce a dynamic resourced based on some user input at the moment of clicking on this component, then you have to use the {{button}} type, in order to submit the form and process all input fields before generating and saving the resource, based on such input.{panel}
 h4. Tutorials
 This component appears in the following ICEfaces tutorials:

© Copyright 2017 ICEsoft Technologies Canada Corp.