调整项目模块,jodconverter-core重命名为office-plugin。jdocnverter-web重命名为server
|
@ -4,7 +4,7 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>jodconverter-core</artifactId>
|
||||
<artifactId>office-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
|
@ -19,6 +19,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.artofsolving.jodconverter.util.ConfigUtils;
|
||||
import org.artofsolving.jodconverter.util.PlatformUtils;
|
||||
|
||||
import com.sun.star.beans.PropertyValue;
|
||||
|
@ -55,7 +56,7 @@ public class OfficeUtils {
|
|||
Map<String,Object> subProperties = (Map<String,Object>) value;
|
||||
value = toUnoProperties(subProperties);
|
||||
}
|
||||
propertyValues[i++] = property((String) entry.getKey(), value);
|
||||
propertyValues[i++] = property(entry.getKey(), value);
|
||||
}
|
||||
return propertyValues;
|
||||
}
|
||||
|
@ -68,7 +69,7 @@ public class OfficeUtils {
|
|||
|
||||
public static File getDefaultOfficeHome() {
|
||||
Properties properties = new Properties();
|
||||
String customizedConfigPath = getCustomizedConfigPath();
|
||||
String customizedConfigPath = ConfigUtils.getCustomizedConfigPath();
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(customizedConfigPath));
|
||||
properties.load(bufferedReader);
|
||||
|
@ -80,7 +81,7 @@ public class OfficeUtils {
|
|||
}
|
||||
if (PlatformUtils.isWindows()) {
|
||||
// %ProgramFiles(x86)% on 64-bit machines; %ProgramFiles% on 32-bit ones
|
||||
String homePath = OfficeUtils.getHomePath();
|
||||
String homePath = ConfigUtils.getHomePath();
|
||||
String programFiles = System.getenv("ProgramFiles(x86)");
|
||||
if (programFiles == null) {
|
||||
programFiles = System.getenv("ProgramFiles");
|
||||
|
@ -127,30 +128,7 @@ public class OfficeUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static String getHomePath() {
|
||||
String userDir = System.getenv("KKFILEVIEW_BIN_FOLDER");
|
||||
if (userDir == null) {
|
||||
userDir = System.getProperty("user.dir");
|
||||
}
|
||||
if (userDir.endsWith("bin")) {
|
||||
userDir = userDir.substring(0, userDir.length() - 4);
|
||||
} else {
|
||||
String separator = File.separator;
|
||||
if (userDir.contains("jodconverter-web")) {
|
||||
userDir = userDir + separator + "src" + separator + "main";
|
||||
} else {
|
||||
userDir = userDir + separator + "jodconverter-web" + separator + "src" + separator + "main";
|
||||
}
|
||||
}
|
||||
return userDir;
|
||||
}
|
||||
|
||||
public static String getCustomizedConfigPath() {
|
||||
String homePath = OfficeUtils.getHomePath();
|
||||
String separator = java.io.File.separator;
|
||||
String configFilePath = homePath + separator + "config" + separator + "application.properties";
|
||||
return configFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* SpringBoot application.properties 支持从环境变量获取值
|
|
@ -0,0 +1,36 @@
|
|||
package org.artofsolving.jodconverter.util;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author : kl
|
||||
**/
|
||||
public class ConfigUtils {
|
||||
|
||||
private static final String MAIN_DIRECTORY_NAME = "server";
|
||||
|
||||
public static String getHomePath() {
|
||||
String userDir = System.getenv("KKFILEVIEW_BIN_FOLDER");
|
||||
if (userDir == null) {
|
||||
userDir = System.getProperty("user.dir");
|
||||
}
|
||||
if (userDir.endsWith("bin")) {
|
||||
userDir = userDir.substring(0, userDir.length() - 4);
|
||||
} else {
|
||||
String separator = File.separator;
|
||||
if (userDir.contains(MAIN_DIRECTORY_NAME)) {
|
||||
userDir = userDir + separator + "src" + separator + "main";
|
||||
} else {
|
||||
userDir = userDir + separator + MAIN_DIRECTORY_NAME + separator + "src" + separator + "main";
|
||||
}
|
||||
}
|
||||
return userDir;
|
||||
}
|
||||
|
||||
public static String getCustomizedConfigPath() {
|
||||
String homePath = getHomePath();
|
||||
String separator = java.io.File.separator;
|
||||
return homePath + separator + "config" + separator + "application.properties";
|
||||
}
|
||||
}
|
6
pom.xml
|
@ -7,8 +7,8 @@
|
|||
<artifactId>filepreview</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<modules>
|
||||
<module>jodconverter-core</module>
|
||||
<module>jodconverter-web</module>
|
||||
<module>office-plugin</module>
|
||||
<module>server</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
@ -33,5 +33,5 @@
|
|||
</profiles>
|
||||
|
||||
<name>file-online-preview</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<description>专注文件在线预览服务</description>
|
||||
</project>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>jodconverter-core</artifactId>
|
||||
<artifactId>office-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
|
@ -0,0 +1,28 @@
|
|||
This page lists all active maintainers of this repository. If you were a
|
||||
maintainer and would like to add your name to the Emeritus list, please send us a
|
||||
PR.
|
||||
|
||||
See [GOVERNANCE.md](https://github.com/grpc/grpc-community/blob/master/governance.md)
|
||||
for governance guidelines and how to become a maintainer.
|
||||
See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md)
|
||||
for general contribution guidelines.
|
||||
|
||||
## Maintainers (in alphabetical order)
|
||||
- [creamsoup](https://github.com/creamsoup), Google LLC
|
||||
- [dapengzhang0](https://github.com/dapengzhang0), Google LLC
|
||||
- [ejona86](https://github.com/ejona86), Google LLC
|
||||
- [ericgribkoff](https://github.com/ericgribkoff), Google LLC
|
||||
- [jiangtaoli2016](https://github.com/jiangtaoli2016), Google LLC
|
||||
- [ran-su](https://github.com/ran-su), Google LLC
|
||||
- [sanjaypujare](https://github.com/sanjaypujare), Google LLC
|
||||
- [srini100](https://github.com/srini100), Google LLC
|
||||
- [voidzcy](https://github.com/voidzcy), Google LLC
|
||||
- [zhangkun83](https://github.com/zhangkun83), Google LLC
|
||||
|
||||
## Emeritus Maintainers (in alphabetical order)
|
||||
- [carl-mastrangelo](https://github.com/carl-mastrangelo), Google LLC
|
||||
- [jtattermusch](https://github.com/jtattermusch), Google LLC
|
||||
- [louiscryan](https://github.com/louiscryan), Google LLC
|
||||
- [nicolasnoble](https://github.com/nicolasnoble), Google LLC
|
||||
- [nmittler](https://github.com/nmittler), Google LLC
|
||||
- [zpencer](https://github.com/zpencer), Google LLC
|
|
@ -0,0 +1,28 @@
|
|||
This page lists all active maintainers of this repository. If you were a
|
||||
maintainer and would like to add your name to the Emeritus list, please send us a
|
||||
PR.
|
||||
|
||||
See [GOVERNANCE.md](https://github.com/grpc/grpc-community/blob/master/governance.md)
|
||||
for governance guidelines and how to become a maintainer.
|
||||
See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md)
|
||||
for general contribution guidelines.
|
||||
|
||||
## Maintainers (in alphabetical order)
|
||||
- [creamsoup](https://github.com/creamsoup), Google LLC
|
||||
- [dapengzhang0](https://github.com/dapengzhang0), Google LLC
|
||||
- [ejona86](https://github.com/ejona86), Google LLC
|
||||
- [ericgribkoff](https://github.com/ericgribkoff), Google LLC
|
||||
- [jiangtaoli2016](https://github.com/jiangtaoli2016), Google LLC
|
||||
- [ran-su](https://github.com/ran-su), Google LLC
|
||||
- [sanjaypujare](https://github.com/sanjaypujare), Google LLC
|
||||
- [srini100](https://github.com/srini100), Google LLC
|
||||
- [voidzcy](https://github.com/voidzcy), Google LLC
|
||||
- [zhangkun83](https://github.com/zhangkun83), Google LLC
|
||||
|
||||
## Emeritus Maintainers (in alphabetical order)
|
||||
- [carl-mastrangelo](https://github.com/carl-mastrangelo), Google LLC
|
||||
- [jtattermusch](https://github.com/jtattermusch), Google LLC
|
||||
- [louiscryan](https://github.com/louiscryan), Google LLC
|
||||
- [nicolasnoble](https://github.com/nicolasnoble), Google LLC
|
||||
- [nmittler](https://github.com/nmittler), Google LLC
|
||||
- [zpencer](https://github.com/zpencer), Google LLC
|
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 323 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 370 KiB |
After Width: | Height: | Size: 254 KiB |
After Width: | Height: | Size: 308 KiB |
After Width: | Height: | Size: 387 KiB |
|
@ -8,11 +8,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@ComponentScan(value = "cn.keking.*")
|
||||
public class FilePreviewApplication {
|
||||
public class ServerMain {
|
||||
|
||||
public static void main(String[] args) {
|
||||
FilePreviewApplication.staticInitSystemProperty();
|
||||
SpringApplication.run(FilePreviewApplication.class, args);
|
||||
ServerMain.staticInitSystemProperty();
|
||||
SpringApplication.run(ServerMain.class, args);
|
||||
}
|
||||
|
||||
private static void staticInitSystemProperty(){
|
|
@ -1,6 +1,6 @@
|
|||
package cn.keking.config;
|
||||
|
||||
import org.artofsolving.jodconverter.office.OfficeUtils;
|
||||
import org.artofsolving.jodconverter.util.ConfigUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class ConfigConstants {
|
|||
private static String FTP_PASSWORD;
|
||||
private static String FTP_CONTROL_ENCODING;
|
||||
private static String BASE_URL;
|
||||
private static String FILE_DIR = OfficeUtils.getHomePath() + File.separator + "file" + File.separator;
|
||||
private static String FILE_DIR = ConfigUtils.getHomePath() + File.separator + "file" + File.separator;
|
||||
private static CopyOnWriteArraySet<String> TRUST_HOST_SET;
|
||||
private static String PDF_DOWNLOAD_DISABLE;
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
package cn.keking.config;
|
||||
package cn.keking.service;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.config.WatermarkConfigConstants;
|
||||
import org.artofsolving.jodconverter.office.OfficeUtils;
|
||||
import org.artofsolving.jodconverter.util.ConfigUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -42,7 +45,7 @@ public class ConfigRefreshComponent {
|
|||
String ftpUsername;
|
||||
String ftpPassword;
|
||||
String ftpControlEncoding;
|
||||
String configFilePath = OfficeUtils.getCustomizedConfigPath();
|
||||
String configFilePath = ConfigUtils.getCustomizedConfigPath();
|
||||
String baseUrl;
|
||||
String trustHost;
|
||||
String pdfDownloadDisable;
|