This module demonstrates Azure Blob Storage integration using the JAQ Stack framework. It provides a complete web application for viewing, managing, and interacting with Azure Blob Storage containers and files.
- Azure Blob Storage Integration - Connect to and manage Azure Blob Storage accounts
- File Management - Upload, download, and delete blob files
- Image Preview - View images directly in the browser
- Container Management - List and manage blob containers
- RESTful API - Complete REST API for blob operations
- Angular Frontend - Modern, responsive user interface
- Java Backend - Robust server-side processing
- Java 11+ - Modern Java with latest features
- Jersey 3.x - RESTful web services framework
- Azure Storage SDK - Official Azure Blob Storage client
- MongoDB - Optional data storage
- Maven - Build and dependency management
- Angular 16+ - Modern reactive frontend framework
- TypeScript - Type-safe development
- Bootstrap - Responsive UI components
- RxJS - Reactive programming
Before building and running this project, ensure you have:
- Java 11+ - Download
- Node.js 18+ - Download
- Angular CLI 16+ -
npm install -g @angular/cli@16 - Maven 3.6+ - Download
- Azure Storage Account - Create Azure Storage Account
git clone https://github.com/JAQStack/jaqstack-examples.git
cd jaqstack-examples/examples/azureblobviewer# Install Angular dependencies
cd ui.resources
npm install
cd ..# Build Angular frontend
cd ui.resources
ng build --prod
cd ..
# Build Java application
mvn clean package# Start the application
mvn tomcat7:run- Open your browser to:
http://localhost:8080/jaqstack-azure-blobviewer - You should see the Azure Blob Viewer interface
-
Create Azure Storage Account
- Go to Azure Portal
- Create a new Storage Account
- Note down the account name and access key
-
Configure Application
- Update the configuration in your application
- Set the Azure Storage account name and key
- Specify the container name to use
- Modify Java services in
src/main/java/ - Build with Maven -
mvn clean package - Run development server -
mvn tomcat7:run - Test APIs using Postman or browser
- Navigate to UI resources -
cd ui.resources/ - Install dependencies -
npm install - Start development server -
ng serve - Build for production -
ng build --prod
- Start backend -
mvn tomcat7:run - Start frontend -
cd ui.resources && ng serve - Access application -
http://localhost:4200
- URL:
/service/blobservice/azure/fetch - Method: POST
- Description: Retrieve list of blobs from Azure Storage
Request Body:
{
"azureAccountName": "your-storage-account-name",
"azureAccountKey": "your-storage-account-key",
"azureContainer": "your-container-name"
}Response:
[
{
"blobName": "example.png",
"blobURL": "https://yourstorageaccount.blob.core.windows.net/yourcontainer/example.png",
"blobMimeType": "image/png"
}
]- URL:
/service/blobservice/azure/upload - Method: POST
- Description: Upload file to Azure Blob Storage
- URL:
/service/blobservice/azure/download - Method: GET
- Description: Download blob from Azure Storage
- URL:
/service/blobservice/azure/delete - Method: DELETE
- Description: Delete blob from Azure Storage
- Access the application:
http://localhost:8080/jaqstack-azure-blobviewer - Navigate to the interface and test blob operations
- Verify file upload/download functionality
POST http://localhost:8080/jaqstack-azure-blobviewer/service/blobservice/azure/fetch
Content-Type: application/json
{
"azureAccountName": "your-storage-account",
"azureAccountKey": "your-access-key",
"azureContainer": "your-container"
}POST http://localhost:8080/jaqstack-azure-blobviewer/service/blobservice/azure/upload
Content-Type: multipart/form-data
# Include file in form datamvn tomcat7:run-
Build the application:
mvn clean package
-
Deploy to Tomcat:
- Copy
target/jaqstack-azure-blobviewer.warto Tomcatwebappsdirectory - Start Tomcat server
- Access at:
http://localhost:8080/jaqstack-azure-blobviewer
- Copy
- Open Tomcat Manager:
http://localhost:8080/manager/html - Upload WAR file: Select
jaqstack-azure-blobviewer.war - Deploy application
- Access application:
http://localhost:8080/jaqstack-azure-blobviewer
- Azure Storage Keys: Store securely, never commit to version control
- HTTPS: Use HTTPS in production environments
- Access Control: Implement proper authentication and authorization
- CORS: Configure CORS settings for cross-origin requests
Problem: Cannot connect to Azure Storage Solutions:
- Verify Azure Storage account name and key
- Check network connectivity
- Ensure storage account is accessible
- Verify container name exists
Problem: Maven build fails Solutions:
- Clean and rebuild:
mvn clean package - Check Java version:
java -version(should be 11+) - Verify Maven installation:
mvn -version - Clear Maven cache:
mvn dependency:purge-local-repository
Problem: Angular build fails Solutions:
- Update Angular CLI:
npm install -g @angular/cli@16 - Clear npm cache:
npm cache clean --force - Delete node_modules and reinstall:
rm -rf node_modules && npm install - Check Node.js version:
node -v(should be 18+)
Problem: Port 8080 is already in use Solutions:
- Stop other services using port 8080
- Change Tomcat port in configuration
- Use different port:
mvn tomcat7:run -Dmaven.tomcat.port=8081
- Fork the repository
- Create a feature branch -
git checkout -b feature/amazing-feature - Commit your changes -
git commit -m 'Add amazing feature' - Push to the branch -
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Happy Coding with JAQ Stack Azure Blob Viewer! 🚀