Managing Resources
Applications rely on various types of resources, such as JavaScript, CSS, and images. This document provides a comprehensive technical exploration of webforJ’s resource-handling mechanisms, covering declarative annotations, programmatic API methods, and custom protocol utilization.
webforJ adopts a modular approach to resource management, offering multiple mechanisms to address different app needs:
- Declarative Annotations: Embed JavaScript and CSS resources at the components or app level.
- API-Based Dynamic Injection: Inject resources at runtime to enable dynamic app behavior.
- Custom Protocols: Provide standardized methodologies for resource access.
- File Streaming and Controlled Downloads: Facilitate managed retrieval and transmission of resource files.
Topics
📄️ Importing Assets
Attach JavaScript and CSS to webforJ components or the app using JavaScript, InlineJavaScript, StyleSheet, and InlineStyleSheet annotations.
📄️ Assets Protocols
Reference app resources with the webforJ ws, context, and icons protocols to load static files, classpath content, and dynamic icons.
📄️ Downloading Files
Trigger client-side downloads from webforJ using the Page download methods that accept input streams, byte arrays, files, or resource paths.