O2OA服务器支持使用webdav协议来存储二进制文件.
Tomcat默认是支持WebDAV的,且默认为禁用状态.
可以开启Tomcat的webdav作为文件存储服务器.
开启步骤如下:
1.在tomcat的webapp是目录下创建一个webdav目录作为项目.
2.在webdav目录下创建WEB-INF/web.xml
web.xml内容如下:

xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>webdavdisplay-name>
    <welcome-file-list>
        <welcome-file>index.htmlwelcome-file>
        <welcome-file>index.htmwelcome-file>
        <welcome-file>index.jspwelcome-file>
        <welcome-file>default.htmlwelcome-file>
        <welcome-file>default.htmwelcome-file>
        <welcome-file>default.jspwelcome-file>
    welcome-file-list>
    <servlet>
        <servlet-name>webdavservlet-name>
        <servlet-class>org.apache.catalina.servlets.WebdavServletservlet-class>
        <init-param>
            <param-name>debugparam-name>
            <param-value>0param-value>
        init-param>
        <init-param>
            <param-name>listingsparam-name>
            <param-value>trueparam-value>
        init-param>
        
        <init-param>
            <param-name>readonlyparam-name>
            <param-value>falseparam-value>
        init-param>
    servlet>
    
    <servlet-mapping>
        <servlet-name>webdavservlet-name>
        <url-pattern>/*url-pattern>
    servlet-mapping>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>webdavweb-resource-name>
            
            <url-pattern>/*url-pattern>
            <http-method>PROPFINDhttp-method>
            <http-method>PROPPATCHhttp-method>
            <http-method>COPYhttp-method>
            <http-method>MOVEhttp-method>
            <http-method>LOCKhttp-method>
            <http-method>UNLOCKhttp-method>
        web-resource-collection>
        
        <auth-constraint>
            <role-name>*role-name>
        auth-constraint>
    security-constraint>
    <login-config>
        <auth-method>BASICauth-method>
        <realm-name>webdavrealm-name>
    login-config>
    <security-role>
        <description>WebDAV Userdescription>
        <role-name>webdavrole-name>
    security-role>
web-app>

3.在tomcat/conf目录下的tomcat-users.xml文件中添加webdav访问用户
4.启动Tomcat

xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
  <role rolename="webdav"/>
  <user username="admin" password="admin" roles="webdav"/>
tomcat-users>

5.在o2server/configSample目录下拷贝externalStorageSources.json到o2server/config目录
修改配置指向webdav

{
  "file": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/file/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "processPlatform": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/processPlatform/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "mind": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/mind/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "meeting": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/meeting/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "calendar": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/calendar/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "okr": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/okr/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "cms": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/cms/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "bbs": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/bbs/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "report": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/report/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "strategyDeploy": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/strategyDeploy/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "teamwork": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/teamwork/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ],
  "structure": [
    {
      "protocol": "webdav",
      "username": "admin",
      "password": "admin",
      "host": "127.0.0.1",
      "port": 8080.0,
      "prefix": "/repository/default/structure/",
      "enable": true,
      "weight": 100.0,
      "name": "251",
      "deepPath": false,
      "###protocol": "协议,可选值ftp,webdav###",
      "###username": "登录用户名.###",
      "###password": "登录密码.###",
      "###host": "主机地址.###",
      "###port": "端口.###",
      "###prefix": "前缀路径.###",
      "###enable": "是否启用###",
      "###weight": "设置权重.###",
      "###name": "存储节点名,对应存储名称,谨慎修改.###",
      "###deepPath": "是否使用更深的路径.###"
    }
  ]
}

6.在o2server/config目录下将node_xxx.xxx.xxx.xxx.json中的storage服务器设置为禁用.

  "storage": {
    "enable": false,
    "port": 20040.0,
    "sslEnable": false,
    "name": "251",
    "accounts": [],
    "prefix": "",
    "deepPath": false,
    "###enable": "是否启用,对于二进制流文件,比如附件,图片等存储在单独的文件服务器中,可以支持多种文件服务器,默认情况下使用ftp服务器作为文件服务器,每个节点可以启动一个文件服务器以提供高性能.###",
    "###port": "ftp服务器端口,此端口可以不对外开放,仅有ApplicationServer进行访问,并不直接对用户提供服务.###",
    "###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###",
    "###name": "名称,多个节点中不能重名,默认为251.###",
    "###accounts": "二进制流文件是分多个账号分段存储的,可以单独设置每个分类的存储配置,一般不需要设置.###",
    "###passivePorts": "ftp传输有主动和被动之分,如果使用了被动传输,设置被动端口范围,默认为29000-30000.###",
    "###prefix": "路径前缀.###",
    "###deepPath": "使用更深的路径###"
  }

7.启动服务器o2server服务已经将存储转向tomcat服务器所提供的webdav服务.
tomcat-users.xml
webdav.zip

推荐文章:

快速入门-自定义表数据分页样例
2021-02-07
一、分页获取自定义表数据接口代码var getRowCount = function(tableFlag,where){    var data = {};  
开发平台功能概述
2021-02-18
O2OA并不是一款传统意义上的OA系统。它是一款以流程管理为核心的全开源全免费的信息化开发平台,完整的代码可以直接在Github和Gitee上下载,并且不需要支
组织人员同步-自定义同步接口代码
2021-03-03
O2OA允许用户自定义接口和代码逻辑来完成系统与第三方业务系统的数据同步,人员和组织的同步。本文主要介绍如何在O2OA中开发接口与外部系统进行组织和人员的同步,
常见问题-服务器错误:can not decrypt token
2021-02-07
cannotdecrypttoken服务端无法解开token,可能的原因是,xadmin的密码刚刚修改过而前台没有刷新页面.重新刷新前台页面即可,app端需要重
常见问题-服务器和日志时间相差12小时的问题
2021-02-07
解决方案:修改start_linux.sh,在最后的调用java命令的参数中添加时区参数:-Duser.timezone=GMT+08重启后生效!
系统配置-主要配置文件说明
2021-02-25
O2OA开发平台有比较多的配置文件,目前多数配置已经已经可以直接在WEB端进行修改。本章节主要讲述O2OA信息化系统开发平台支持的配置文件以及各项配置相关的用途
企业网盘使用手册
2021-02-19
O2OA企业网盘可以集中储存、管理公司内的文件,确保数字资产安全,支持远程访问,将文件分享给个人、组织、群组。
权限管理-平台组织人员权限管理
2021-02-25
O2OA开发平台组织架构管理组件不局限于传统的组织,群组,角色,人员的关系,在减小授权管理的复杂性基础上,通过独特的职位管理,汇报关系管理思想,增强了架构管理的
云服务器-阿里云ECS服务器的端口启用
2021-02-07
O2OA成功启动后,有可能无法正常访问服务器,需要在ECS进行安全策略配置,开放端口:80、20020、20030在阿里云上完成O2OA平台部署,并且启动完成后
平台维护-在线部署自定义应用的WAR包和JAR包
2021-02-26
在使用O2OA实现项目的过程中,特殊需求在平台现有功能无法直接提供的情况下,可以通过平台提供的自定义war|jar包,实现平台功能的扩展,满足各种不同的需求功能

results matching ""

    No results matching ""