Using symbolic links with Servoy (Tomcat)

Good morning everybody.

I have a customer who is running Servoy Application Server on Linux. Our web application must show some product images which are in a symbolic link under webapps/ROOT/uploads. So the path is like application_server/server/webapps/ROOT/uploads/IMAGENES.

I´m not able to read the content of that folder, if I place the images inside a real folder I have no problem, but using the symbolic link it is impossible.

I found a link in internet that says that I have to add the following to the conf/server.xml file:

<context path="/mi-aplicacion" 
         docBase="DIRECTORIO_de_mi_aplicacion"
         allowLinking="true"/>

So far so good, but can anyone tell me what are the values for path and docBase in my situation.

Thanks in advance

Hi Juan,

I assume you want to link directly from the web browser?

just use: my_url:port/uploads/IMAGENES/my_image.jpg

I’m not sure of the correct syntax to add it directly into server.xml file, but the following seems to work.

  1. Create directory webapps/ROOT/META-INF (if it doesn’t already exist).
  2. Create a file named context.xml within that directory and give it the following content:
<?xml version="1.0" encoding="UTF-8"?>
	<Context path="/uploads" override="true" allowLinking="true">
</Context>

3)Restart Servoy and you should be serving up your image files.

For some more information on symlinks within Tomcat, have a look at this StackOverflow.