Standard Integration Example
A document management integration example project based on Spring Boot, demonstrating how to integrate with the document platform.
If you need to view the complete API documentation, please visit Docs API Manual.
GitHub Repository Frontend SDK integration is in the js-sdk-mount-solution/java/filez-demo directory
This project is for testing and demonstration purposes only. Do not use it directly on production servers. Appropriate code modifications and security hardening are required!
Technology Stack
- Framework: Spring Boot 2.5.4
- Database: SQLite (embedded database, no additional installation required)
- ORM: MyBatis Plus 3.4.3.4
- Template Engine: FreeMarker
- API Documentation: Knife4j (Swagger)
- JSON Processing: Fastjson 1.2.83
- JWT: JJWT 0.9.1
- HTTP Client: Apache HttpClient 4.5.13
Prerequisites
- Java: JDK 8 or higher
- Maven: 3.6 or higher
Project Structure
filez-demo/
├── src/main/java/com/filez/demo/
│ ├── controller/ # Controller layer
│ │ ├── LoginController.java # Login controller
│ │ ├── HomeController.java # Home controller
│ │ ├── FileController.java # File operation controller
│ │ └── ZOfficeController.java # ZOffice integration controller ⭐
│ ├── service/ # Business logic layer
│ ├── config/ # Configuration classes
│ │ └── ZOfficeConfig.java # ZOffice configuration ⭐
│ └── common/ # Common components
├── src/main/resources/
│ ├── application.yml # Main configuration file
│ └── zoffice.yml # ZOffice integration configuration ⭐
├── target/ # Compilation output directory
└── logs/ # Log files
Quick Start
1. Build Project
# Clone code
git clone <repository-url>
cd filez-demo
# Build package
mvn clean package -DskipTests
After successful compilation, the filez-demo-1.0.0.RELEASE.jar file will be generated in the target/ directory.
2. Configure Application
Edit src/main/resources/application.yml:
server:
port: 8000
demo:
host: 172.16.34.165 # Current application server address
context: /v2/context
Edit src/main/resources/zoffice.yml:
zoffice:
service:
host: 172.16.34.165 # ZOffice server address
port: 8001 # ZOffice server port
app:
secret: default-salt # Application secret, used for request signing, must be consistent with the ZOffice server configuration
3. Start Application
Foreground Start (Development Environment)
java -jar target/filez-demo-1.0.0.RELEASE.jar
Background Start (Production Environment)
Linux/macOS:
nohup java -jar target/filez-demo-1.0.0.RELEASE.jar > logs/app.log 2>&1 &
Windows PowerShell:
Start-Process java -ArgumentList "-jar","target/filez-demo-1.0.0.RELEASE.jar" -WindowStyle Hidden
4. Access Application
| Service | Address | Description |
|---|---|---|
| Home | http://localhost:8000 | Application main entry |
| API Documentation | http://localhost:8000/doc.html | Swagger API documentation |
| File Management | http://localhost:8000/home/local | Document management interface |
Default Account: Username admin, Password zOffice
ZOffice Integration Key Code
1. ZOfficeController.java
Core controller that handles all ZOffice integration interfaces:
@RestController
@RequestMapping("/v2/context")
public class ZOfficeController {
// Open document page online
@GetMapping("/openDoc")
public Result openDoc(@RequestParam String docId,
@RequestParam String mode) {
// Return online document page
}
// Download document content
@GetMapping("/{docId}/content")
public void downloadContent(@PathVariable String docId,
HttpServletResponse response) {
// Return document binary stream
}
// Upload document content
@PostMapping("/{docId}/content")
public Result uploadContent(@PathVariable String docId,
HttpServletRequest request) {
// Save edited document
}
}
2. ZOfficeConfig.java
ZOffice service configuration:
@Component
@ConfigurationProperties(prefix = "zoffice")
public class ZOfficeConfig {
private Service service;
public static class Service {
private String host; // ZOffice server address
private Integer port; // ZOffice server port
}
}
3. zoffice.yml
ZOffice configuration file:
zoffice:
service:
host: 172.16.34.165
port: 8001
app:
secret: default-salt
Stop Service
# Linux/macOS - Find process
ps aux | grep filez-demo
# Stop process
kill <PID>
# Windows - Find process
tasklist | findstr java
# Stop process
taskkill /PID <PID> /F
View Logs
# Linux/macOS
tail -f logs/filezDemo.log
# Windows
Get-Content logs/filezDemo.log -Wait -Tail 50
Reference Resources
- API Documentation - Access after starting the application
- Spring Boot Documentation