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:
- Frontend bundler: Bring npm packages, component frameworks, and stylesheet languages into the app through a compiled entry. This is the default path for frontend assets, and it does everything the annotations do.
- Declarative Annotations: Embed JavaScript and CSS resources at the components or app level, with no build step.
- 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.
Frontend bundler
3 items
Downloading Files
Trigger client-side downloads from webforJ using the Page download methods that accept input streams, byte arrays, files, or resource paths.