2017-06-06 71 views
0

我有一个Web应用程序,我必须在客户端提供对已安装的网络驱动器的直接访问(例如\\server\zentrale映射到驱动器Z:\)。JSF/Primefaces链接到文件系统

我试过以下,但没有任何工程:

<a target="_blank" href="file:///server/zentrale/username/data">user files</a> 
<h:outputlink target="_blank" value="file:///server/zentrale/username/data">user files</a> 

<a target="_blank" href="file:///Z:/username/data">user files</a> 
<h:outputlink target="_blank" value="file:///Z:/username/data">user files</a> 

我也在我jboss-web.xml添加<disable-cross-context>false</disable-cross-context> - 没有成功。

@BalusC在JSF 2 and a link to file system中提到要创建一个新的webapp上下文。 那么,我如何使用WildFly 10和Primefaces 6.1来做到这一点?

在我们的WebApplication的旧版本中,我们使用了Firefox的IE View插件,但是这是2013年的最后一次更新!因为我们必须支持Chrome和IE等其他浏览器,所以我们不希望依赖某些浏览器插件!

+1

这将**从来没有**在体面的浏览器工作...纯html安全问题...(尝试一个普通的html文件,也不会工作)。所有这些都在你提到的链接中提到。 – Kukeltje

回答

0

https://developer.jboss.org/thread/227893我发现了一个提示,如何访问服务器端的本地文件系统。

standalone.xml

<subsystem xmlns="urn:jboss:domain:undertow:3.0"> 
    <buffer-cache name="default"/> 
    <server name="default-server"> 
     <http-listener name="default" socket-binding="http" redirect-socket="https"/> 
      <host name="default-host" alias="localhost"> 
       <location name="/" handler="welcome-content"/> 
       <location name="documents" handler="document-handler"/> 
       <filter-ref name="server-header"/> 
       <filter-ref name="x-powered-by-header"/> 
      </host> 
    </server> 
    <handlers> 
     <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/> 
     <file name="document-handler" directory-listing="true" path="\\server\Zentrale\docments"/> 
    </handlers> 
</subsystem> 

要使用此jboss-cli.sh使用以下命令实现:

/subsystem=undertow/server=default-server/host=default-host/location=documents:add(handler=document-handler) 
/subsystem=undertow/configuration=handler/file=document-handler:add(path=\\\\server\\Zentrale\\documents, directory-listing=true) 

page.xhtml每个链接的点击打开浏览器,我可以导航在新标签服务器的文件系统 - 甚至在共享文件夹上!

page.xhtml

<a href="/documents/projects/project_4711/" target="_blank">Project 4711</a> 
<h:outputLink value="/documents/projects/project_4711/" target="_blank">Project 4711</h:outputLink> 

这是我的问题的解决方案,但肯定的 - 它不会让我在客户端本地文件系统导航!

+0

为此更好地使用servlet(使您的应用程序服务器无关) – Kukeltje

+0

是否有任何提示如何使用servlet执行此操作? – raho

+1

是的,搜索stackoverflow和谷歌。很多例子 – Kukeltje

相关问题