Configure Symlinks for single directory in Tomcat

后端 未结 7 1144
情歌与酒
情歌与酒 2020-12-05 06:55

I have a directory to which a process uploads some .pdf files. This process is out of my control.

I need to make those files available through the websi

7条回答
  •  天命终不由人
    2020-12-05 07:53

    There are a few problems with the solution of creating a META-INF/context.xml that contains

    The biggest issue is that if a conf/context.xml exists, the allowLinking in the there takes precedence over a in a META-INF/context.xml. And if the in the conf/context.xml does not explicitly define allowLinking, that's the same as saying allowLinking="false". (see my answer to a context precedence question)

    To be sure that your app allows linking, you have to say .

    Another issue is that the path="/myapp" is ignored in a META-INF/context.xml. To prevent confusion, it's best to leave it out. The only time path in a has any effect is in the server.xml, and the official Tomcat docs recommend against putting s in a server.xml.

    Finally, instead of a myapp/META-INF/context.xml file, I recommend using a conf/Catalina/localhost/myapp.xml file. This technique means you can keep the contents of your META-INF clean, which is the guts of your webapp -- I don't like to risk mucking about in the guts of my webapp. :-)

提交回复
热议问题