我需要通过web URL提供我的网络共享文件夹。我正在使用JettyRunner来提供目录。
我的网络共享是\nas01.internal.local
我可以在文件资源管理器中使用此路径浏览\复制\删除文件。我需要通过网络URl访问它。
有了码头转轮,我可以通过http://localhost:8080
、使d:
可用
java -jar jetty-runner.jar d:
但我不能用网络共享做同样的事情
java -jar jetty-runner.jar \nas01.internal.local
我收到以下错误,
2016-05-18 08:18:47.530:INFO::main: Logging initialized @228ms
2016-05-18 08:18:47.561:INFO:oejr.Runner:main: Runner
java.net.MalformedURLException: no protocol: \nas01.internal.local
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at org.eclipse.jetty.util.resource.Resource.newResource(Resource.java:16
2)
at org.eclipse.jetty.util.resource.Resource.newResource(Resource.java:14
6)
at org.eclipse.jetty.runner.Runner.configure(Runner.java:418)
at org.eclipse.jetty.runner.Runner.main(Runner.java:556)
Usage: java [-Djetty.home=dir] -jar jetty-runner.jar [--help|--version] [ server
opts] [[ context opts] context ...]
Server opts:
--version - display version and exit
--log file - request log filename (with optional 'yyyy
_mm_dd' wildcard
--out file - info/warn/debug log filename (with option
al 'yyyy_mm_dd' wildcard
--host name|ip - interface to listen on (default is all in
terfaces)
--port n - port to listen on (default 8080)
--stop-port n - port to listen for stop command
--stop-key n - security string for stop command (require
d if --stop-port is present)
[--jar file]*n - each tuple specifies an extra jar to be a
dded to the classloader
[--lib dir]*n - each tuple specifies an extra directory o
f jars to be added to the classloader
[--classes dir]*n - each tuple specifies an extra directory o
f classes to be added to the classloader
--stats [unsecure|realm.properties] - enable stats gathering servlet context
[--config file]*n - each tuple specifies the name of a jetty
xml config file to apply (in the order defined)
Context opts:
[[--path /path] context]*n - WAR file, web app dir or context xml file
, optionally with a context path
码头有可能吗?
我认为在这种情况下,最好是"安装"\nas01.internal.local到某个本地驱动器(比如Z:),并指向码头与之一起运行。
这个挂载是在操作系统级别完成的,所以从Java应用程序的角度来看,驱动器的行为就像本地驱动器一样。
否则,由于原因是为了与NAS对话,仅仅使用Java的内置URL是不够的,因此您必须实现一些协议(或者更好地使用第三方)