java - Microsoft Word 忽略从 WebDAV 服务器发送的锁定状态

标签 java servlets ms-word ms-office webdav

我正在使用自定义WebDAV implementation (基于java servlet)。这似乎在很大程度上运作良好 - 除了 Microsoft Word 不会报告锁定文档已锁定给用户。因此,用户可以编辑文档,直到他们尝试保存文档为止,此时用户会在 Microsoft Word 中看到一条不友好的“上传失败”消息。

Upload Failed upon saving a document that is locked by another user.

我的问题的主要目的是了解我是否可以修改 WebDAV 响应以便执行以下一项或多项操作:

  1. 让 Microsoft Word 向用户显示一条消息,说明文档当前已锁定。
  2. 如果存在锁定,则强制 Microsoft Word 以只读状态打开文档。

我运行了 fiddler 并分析了请求和响应轨迹,与 specifications for WebDAV 进行了比较。 。我有点不确定接下来该去哪里,所以非常欢迎任何 WebDAV 专家的帮助!

<小时/>

请求 1

HEAD http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
User-Agent: Microsoft Office Existence Discovery
Connection: Keep-Alive
Host: webdavserver:7161

响应 1

HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 11:45:32 GMT
Content-Type: application/msword
Last-Modified: Wed, 05 Nov 2014 11:45:30 GMT
ETag: W/"77312-1415187930429"
X-Powered-By: Servlet/2.5 JSP/2.1
<小时/>

请求 2

LOCK http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Type: text/xml; charset="utf-8"
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
Translate: f
Timeout: Second-3600
Connection: Keep-Alive
Content-Length: 199
Host: webdavserver:7161

<?xml version="1.0" encoding="utf-8" ?><D:lockinfo xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner><D:href>DOMAIN\user</D:href></D:owner></D:lockinfo>

响应 2

HTTP/1.1 207 Unknown
Date: Wed, 05 Nov 2014 11:45:32 GMT
Content-Length: 307
Content-Type: text/xml; charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1

<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:"><D:response><D:href>http://tidevwls03:7161/OpenTwinsApp/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc</D:href>
<D:status>HTTP/1.1 423 Locked</D:status>
</D:response>
</D:multistatus>
<小时/>

请求 3

GET http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Connection: Keep-Alive
Content-Type: text/xml; charset="utf-8"
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
Depth: 0
Translate: f
Connection: Keep-Alive
Host: webdavserver:7161

响应 3

HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 11:45:32 GMT
Transfer-Encoding: chunked
Content-Type: application/msword
Last-Modified: Wed, 05 Nov 2014 11:45:30 GMT
ETag: W/"77312-1415187930429"
X-Powered-By: Servlet/2.5 JSP/2.1

[byte stream]
<小时/>

请求 4

PROPFIND http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Type: text/xml; charset="utf-8"
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
Depth: 0
Translate: f
Connection: Keep-Alive
Content-Length: 208
Host: webdavserver:7161

<?xml version="1.0" encoding="utf-8" ?><D:propfind xmlns:D="DAV:" xmlns:Office="urn:schemas-microsoft-com:office:office"><D:prop><D:creationdate/><D:getlastmodified/><Office:modifiedby/></D:prop></D:propfind>

响应 4

HTTP/1.1 207 Unknown
Date: Wed, 05 Nov 2014 11:45:33 GMT
Content-Type: text/xml; charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1

<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:"><D:response><D:href>http://tidevwls03:7161/OpenTwinsApp/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc</D:href>
<D:propstat><D:prop><D:creationdate>2014-11-05T11:45:30Z</D:creationdate>
<D:getlastmodified>Wed, 05 Nov 2014 11:45:30 GMT</D:getlastmodified>
</D:prop>
<D:status>HTTP/1.1 423 Locked</D:status>
</D:propstat>
<D:propstat><D:prop><modifiedby xmlns="urn:schemas-microsoft-com:office:office"/></D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
</D:multistatus>
<小时/>

从此时起,Microsoft Word 似乎会轮询服务器,尝试获取文档的锁定。用户仍然不知道文档被锁定。我认为这证明了 Word 知道锁。

请求 5

LOCK http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
If: (<>)
Translate: f
Timeout: Second-3600
Connection: Keep-Alive
Host: webdavserver:7161

响应 5

HTTP/1.1 207 Unknown
Connection: close
Date: Wed, 05 Nov 2014 11:46:07 GMT
Content-Length: 307
Content-Type: text/xml; charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1

<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:"><D:response><D:href>http://tidevwls03:7161/OpenTwinsApp/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc</D:href>
<D:status>HTTP/1.1 423 Locked</D:status>
</D:response>
</D:multistatus>

最佳答案

响应 2 有多个问题:

关于java - Microsoft Word 忽略从 WebDAV 服务器发送的锁定状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26757591/

相关文章:

java - XML 节点转换时未声明命名空间

java - eclipse:导入(类名)无法解析

java - 是否可以将 CORS header 添加到 Tomcat 容器中来自 j_security_check 的响应

ajax - 如何为 AJAX 查询返回纯文本?

Java Word Apache POI - 垂直对齐单元格内容/删除文本后的空格

c# - Microsoft Word 中的 SaveCopyAs 行为

java - JDOM.Element.getChild(String) 返回意外结果

java - 使用ServerSockets和Sockets时,BufferedReader挂起,并且看来连接形式不正确

java - 未找到 HTTP 404(未找到 Servlet)

delphi - 在 Delphi 中启动 Word x64