在客户端上使用正确的程序打开 webdav 链接

发布于 2024-07-09 14:12:50 字数 465 浏览 7 评论 0原文

我们有一个基于浏览器的应用程序,集成了 webdav 服务器。 我们在 (webdav) servlet 上生成特定文档的 URL。 (https://server.com/webdav/path/to/file.doc)

我们正在寻找一种让客户直接在适当的程序中打开这些链接的好方法。 对于 Windows 用户,IE 中的“https://server.com/webdav/path/to/excelfile.xls”应在 MS Excel 中打开,而同一链接应在 Linux 上打开 OOCalc。

到目前为止,我们一直在使用一个小小程序,它映射扩展、操作系统和程序,并通过 Runtime.getRuntime().exec(..) 打开程序。 这种方法在 Ms-Windows 上工作得还不错,但在 Linux 和 Mac 客户端上就会出现问题,而且非常不灵活。

有更好的方法吗?

We have a browser based application which integrates a webdav server. We generate URLs to specific documents on our (webdav) servlet. (https://server.com/webdav/path/to/file.doc)

What we are looking for is a good way for our clients to open these links directly in the appropriate program. I.E. for a windows user, "https://server.com/webdav/path/to/excelfile.xls" should open in MS Excel, while the same link should open OOCalc on Linux.

So far, we've been using a small applet which maps has extensions, OS's, and programs and opens the program through Runtime.getRuntime().exec(..) . This approach works somewhat ok on Ms-Windows but is problematic on Linux and mac clients and is also quite inflexible.

Is there any better way of doing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

浊酒尽余欢 2024-07-16 14:12:50

这不是 java.awt.Desktop 类的设计目的吗?

我说“专为”而设计,因为它在很多事情上做得不好或不正确,但它确实对某些事情有用。 它缺少“打开方式”选项,就像操作系统必须提示您在没有注册任何内容的情况下应该使用什么方式打开文档一样。

它可能会将 url 解释为 Web url,打开浏览器,然后浏览器可能会委托打开文件? 在这种情况下,您必须将文档下载到临时文件,然后使用desktop.open?

Isn't this what tha java.awt.Desktop class was designed for?

I say "Designed for" because there are a lot of things that it doesn't do well or correctly, but it does work for some things. Its missing the option for "open with", like the operating system has to prompt you for what you should open a document with if there's nothing registered for it.

It might interpret the url as a web url, open the browser, and then the browser might delegate to opening the file? in that case you'd have to download the document to a temp file and then use desktop.open?

私野 2024-07-16 14:12:50

如果将文件的 MIME 类型设置为正确的格式,所有浏览器都应该能够处理它们。 然后,用户可以决定对该类型采取默认操作(打开 acrobat、word、excel、记事本)或选择自定义操作。

If you set the MIME types of the files to the proper format, all browsers should be able to handle them. The user can then decide to take the default action for that type(open acrobat, word, excel, notepad) or pick a custom one.

情场扛把子 2024-07-16 14:12:50

如今,它在 Internet Explorer 10/11 中运行良好。 但您必须添加注册表项才能允许 Office 以读/写方式打开从浏览器传递的文档。 注册表键值如下:

Office 2013:

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Internet\OpenDocumentsReadWriteWhileBrowsing = 0x1(DWORD)

Office 2010:

HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Internet\OpenDocumentsReadWriteWhileBrowsing = 0x1 (DWORD)

请参阅此文章了解有关设置密钥的信息:
http://social.technet.microsoft.com/Forums/office/en-US/06fedd90-4889-45ca-949d-60b76d74dd15/ms-word-open-document-readonly-with-WebDAV

It works great in Internet Explorer 10/11 these days. But you will have to add a registry key in order to allow Office to open documents handed off from a browser as read/write. The registry key is as follows:

Office 2013:

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Internet\OpenDocumentsReadWriteWhileBrowsing = 0x1 (DWORD)

Office 2010:

HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Internet\OpenDocumentsReadWriteWhileBrowsing = 0x1 (DWORD)

See this article for information about setting the key:
http://social.technet.microsoft.com/Forums/office/en-US/06fedd90-4889-45ca-949d-60b76d74dd15/ms-word-open-document-readonly-with-WebDAV

长不大的小祸害 2024-07-16 14:12:50

不幸的是,小程序是目前唯一的解决方案。 但在极少数情况下,我们会使用 "SharePoint.OpenDocuments"'application/x-sharepoint' 插件。 您可以在此处与您的解决方案进行比较。

Unfortunately applet is the only solution for now. But in rare cases we use "SharePoint.OpenDocuments" and 'application/x-sharepoint' plugins. You can compare with your solution here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文