Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page is for anyone application designers who needs need to reference files on the PhixFlow Server.

Administrator setting up softlinks

Understanding the Soft Link Between Tomcat and PhixFlow

When you want to reference a file saved on the PhixFlow server, you need to use a path that the PhixFlow Webapp can understand. The PhixFlow webapp runs within Tomcat, so only knows about files below  /opt/tomcat/webapps/phixflow 

For the webapp to know about files stored on the server, for example in  /opt/phixflow/data/phixflow, it has a soft link (also called symbolic link, symlink or data link). This acts as a shortcut between the two directories and lets the PhixFlow webapp "see" the files under /opt/phixflow/data/phixflow/datalink. - If it is on Linux and installed in this location. Also I can see no mention that if you place files in the Webapp itself you could overwrite these during the upgrade, and by having the files outside th base directry the user only needs to reinstate the datalink not all the custom directories they have created.

...

/opt/phixflow/data/phixflow/datalink/

Where has the above come from? This will only exist if someone has already configured it?

- You may not want to save files under the datalink directory on the PhixFlow server. For example, you could have a directory for each project, and the files belong to a specific project. In this case, you can add a second soft link.

...

/opt/phixflow/data/phixflow/datalink/MyProject/

...

To ensure soft links from Tomcat to PhixFlow directories are secure, configure context.xml as follows:

  1. Edit /opt/tomcat/conf/context.xml
  2. Find the line: <Resources cachingAllowed="true" cacheMaxSize="1000000" />
  3. Replace it with: <Resources allowLinking="true" cachingAllowed="true" cacheMaxSize="1000000" />

In the following commands:

  • path/folder_name is the full path to the directory to which you want to link
  • soft_link_name is the directory name you want to use as a soft link in the current directory.

On Linux use the ln command

ln -s path/folder_name soft_link_name - Can we have an example: sudo ln -s /opt/phixflow/data/phixflow/datalink/ /opt/tomcat/webapps/phixflow/

If a file path includes spaces, enclose it in double-quotes

On Windows use the mklink command

mklink /D soft_link_name path/folder_name - Can we have an example

To soft link to a specific file, omit /D.

For more information about symlinks, see this article on Creating Symbolic Links.

The Path or URL to Use

Within PhixFlow, to refer to a file on the server, start the path with the datalink directory.

Examples:

...

ensure files appear 

Within your application screens, you may use images and files that you have uploaded onto the PhixFlow server. For example, your application may need:

  • a file that the user can download
  • an image to be displayed. 

todo-Fiona When do you need to use a soft link rather than just using the file you have uploaded (e.g. in a style, selecting a background image)

Because applications are displayed in browsers, the screens are transmitted to the browser via the Tomcat webserver. If you reference the file using it's path on the PhixFlow server, Tomcat will not be able to serve the image or file to the browser. It will appear as a broken link.

Your administrator can configure the Tomcat webserver to "see" specific PhixFlow directories by creating soft links in the <path>/tomcat/webapps/phixflow directory; see Configuring Soft Links Between PhixFlow and Tomcat. To reference file or image, use the soft link path that Tomcat will recognise.

For example:


The administrator configures a soft link in Tomcat
which points to → 
a PhixFlow server directorywhich contains the file
Linux<path>/tomcat/webapps/phixflow/data-files-link

/opt/phixflow/files/data/


Snapshot.csv
Windows<path>\tomcat\webapps\phixflow\data-files-link<path>/phixflow/files/data/

To create a link to the file Snapshot.csv, use the soft link in tomcat/webapps/phixflow:

  • either using a file path:   data-files-link/Snapshot.csv
  • or using a URL:   url("https:

...

  • data-files-link/Snapshot.csv")

Images and Soft Links

...

In your PhixFlow application, to To display an image stored on the PhixFlow server, use the soft link URL for it's location, for example:, rather than the file path.


For example:


Tomcat has the soft link
which points to → 
a PhixFlow server directorywhich contains the file
Linux<path>/tomcat/webapps/phixflow/images-link

/opt/phixflow/files/images/


MyImage.png
Windows<path>\tomcat\webapps\phixflow\images-link<path>/phixflow/files/images/

To display MyImage.png, use a URL to refer to the soft link   url("https:

...

images-link/MyImage.png")

...

For exampleimages, you can select an image and use the style settings to configure how it looks. If you need to use a soft link, you cannot then use the style settings to configure how it displays. You need to configure all the following CSS Properties to use an image stored on the PhixFlow server as a background image. 

...

settings using CSS Properties. For example, to configure a background image, set CSS Tag and Values as follows:

CSS TagValue
background-image

...

url("https:

...

images-link/MyProject/MyImage.png")

...

background-repeat

...

no-repeat

...

background-size

...

Choose a size, see Image Sizing. Examples: 

  • 100%
  • 20px
  • auto