从appserver获取WebServer中的文件列表
大家好
有没有使用JAVA从应用程序服务器获取Web服务器中的文件列表的方法?
我正在寻找类似的东西
new file ("/webserver_context_root/folder/")method that using the relative path to get the web server's resources from the app server...
PS:Web服务器和应用服务器之间已经设置了反向代理。
有什么想法吗?
Hi all
Is there any methods to fetch the File List in the Web server from the Application Server using JAVA?
i am finding something like
new file ("/webserver_context_root/folder/")
method that using the relative path to get the web server's resources from the app server...
PS : The reverse proxy has been set between the web and application servers.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTTP 协议没有提供列出“文件夹”的标准方法。事实上,HTTP 和 URI / URL 规范甚至不承认“文件夹”是一个概念。
如果文件夹概念对您的网站有意义,那么有两种可行的方法:
许多网络服务器可以配置为生成与网络服务器内容空间中的文件夹相对应的 URL 列表(例如,以 HTML 形式)。 (出于安全原因,这通常被关闭。)您可以“抓取”此 HTML 以提取文件夹中事物的名称列表。
您可以实现 RESTful 服务,以 JSON 或 XML 形式返回“文件夹”中的“文件”列表。
但请注意,这两种方法都特定于该网站。它们不适用于任意网站。我还假设“应用程序服务器”使用 HTTP 访问“Web 服务器”。如果它可以通过其他方式访问它,可能还有其他解决方案。
The HTTP protocol provides no standard way to list a "folder". Indeed, the HTTP and URI / URL specs don't even recognize "folder" as a concept.
If the folder notion is meaningful for your website then there are two approaches that could work:
Many webservers can be configured to produce a listing (e.g. in HTML) for a URL that corresponds to a folder in the webservers content space. (This is usually turned off for security reasons.) You can "scrape" this HTML to extract the list of names of things in the folder.
You could implement a RESTful service to return a list of the "files" in a "folder" as (say) JSON or XML.
Note however, that both approaches will be specific to that website. They won't work for arbitrary websites. I'm also assuming that the "application server" accesses the "web server" using HTTP. If it can access it some other way, there may be other solutions.