与客户端连接时如何浏览服务器计算机的文件系统(java)
我正在进行概念验证,以将业务代码与 ps3 媒体服务器 (http://www.ps3mediaserver.org/) 的 gui 分离。为此,我在 source forge (http://sourceforge.net/projects/pms-remote/) 托管了一个项目。客户端应该是一个简单的前端,可以从网络中的任何位置配置服务器,并有权连接到服务器。
在服务器端,所有服务均已使用 javax.jws 公开,并且客户端代理已使用 wsimport 生成。
当前功能的功能之一(实际上是唯一的阻止功能)是定义服务器将共享的文件夹。由于客户端和服务器现在作为单个应用程序在同一台计算机上运行,因此浏览其文件系统非常简单。
问题:我想通过 Web 服务公开服务器计算机的文件系统。这将允许任何客户端(我当前正在处理的客户端与使用 java swing 的原始客户端相同)显示可用文件夹并选择将由媒体服务器显示的文件夹。最后,我唯一感兴趣的是绝对文件夹路径(字符串)。
我以为我会找到一个为我提供此功能的库,但找不到任何库。 使用 UNC 路径浏览文件并访问远程计算机似乎不可行,因为这对用户来说不透明。
现在我不想担心安全问题,一旦其余的看起来可行,我就会解决这些问题。
如果有任何意见,我将不胜感激。 谢谢,菲利普
I'm in the process of making a proof of concept to dissociate the business code from the gui for the ps3 media server (http://www.ps3mediaserver.org/). For this I've got a project hosted at source forge (http://sourceforge.net/projects/pms-remote/). The client should be a simple front end to configure the server from any location within a network having the rights to connect to the server.
On the server side, all service have been exposed using javax.jws and the client proxy has been generated using wsimport.
One of the features of the current features (actually, the only blocking one), is to define the folders that will be shared by the server. As the client and server are now running as a single application on the same machine, it's trivial to browse its file system.
Problem: I'd like to expose the file system of the server machine through web services. This will allow any client (the one I'm currently working on is the same as the original using java swing) to show available folders and to select the ones that will be shown by the media server. In the end the only thing I'm interested in is an absolute folder path (string).
I thought I'd find a library giving me this functionality but couldn't find any.
Browsing the files using a UNC path and accessing a distant machine doesn't seem feasible, as it wouldn't be transparent for the user.
For now I don't want to worry about security issues, I'll figure these out once the rest seems feasible.
I'd be grateful for any input.
Thanks, Philippe
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终创建了一个非常简单的 Web 服务,可以列出给定路径的所有根文件夹或所有子文件夹。
现在,客户端需要拥有一个 (GUI) 浏览器来访问此服务。
对于想要使用它的人,这里还有 ServiceBase 类
I've ended up creating a pretty simple web service letting either list all root folders or all child folders for a given path.
It's now up to the client to have a (GUI) browser to access this service.
For people wanting to use this, here's the ServiceBase class as well
从客户端,您可以利用 的输出
smbclient -L
。在服务器上,合适的 servlet可能会。From the client, you might be able to leverage the output of
smbclient -L
. On the server, a suitable servlet might do.