简体   繁体   中英

serve network share directory with jetty-runner

I need to make my network share folder available via web URL. I am using jetty runner to serve directory.

My network share is \\\\nas01.internal.local I can use this path in file explorer to browse\\copy\\delete files.I need to make it accessible via web URl.

With jetty-runner I can make d:\\ available via http://localhost:8080 ,

java -jar jetty-runner.jar d:\

But I can not do same with network share

java -jar jetty-runner.jar \\nas01.internal.local

I get following error,

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

Is this possible with jetty?

I think in this case the best would be "mounting" the \\nas01.internal.local to some local drive (say Z:) and pointing the jetty to run with it.

This mounting is done at the OS level, so from the point of view of Java application the drive will behave just like a local one.

Otherwise, since the reason is that in order to talk to NAS its not enough to use Java's built in URL, you'll have to implement some protocols (or better use thirdparties)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM