...
...
...
...
...
...
...
...
...
...
...
...
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
This page is for
...
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.
...
application designers who need the ability to download files and/or access them programmatically.
Within your application screens, you may use images and files that have been uploaded onto the PhixFlow server. For example,
- allowing users to download a file.
- displaying an image based on expression logic. For example, display a user image based on the logged in user.
Your administrator should have configured the Tomcat webserver to see specific directories by creating soft links from a source to a target. See Install the PhixFlow Webapp. Strictly speaking this is an optional step, but it part of the recommended installation for PhixFlow. If you are not sure, please talk to your system administrator.
For example:
Operating System | Source (Tomcat) | which points to → | Target (Directory) | Example Files |
---|---|---|---|---|
Linux | <path>/tomcat/webapps/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.
...
Snapshot.jpg MyData.xlsx | ||
Windows | <path>\tomcat\webapps\phixflow\ | <path>/phixflow/ |
...
Securing Soft Links
To ensure soft links from Tomcat to PhixFlow directories are secure, configure context.xml as follows:
- Edit
/opt/tomcat/conf/context.xml
- Find the line:
<Resources cachingAllowed="true" cacheMaxSize="1000000" />
- Replace it with:
<Resources allowLinking="true" cachingAllowed="true" cacheMaxSize="1000000" />
Creating Soft Links
In the following commands:
path/folder_name
is the full path to the directory to which you want to linksoft_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:
- file path:
datalink/Project1/Images/file1.png
- URL:
url("https:datalink/MyProject/MyImage.png")
...
To access the files use the soft link:
- To create a download, create an action which opens the URL: "datalink/MyData.xlsx"
Note, not all file types will invoke a download, for example a PDF will simply open in a new browser tab.
- For display, an image or PDF can be embedded in a URL component using the value: url("https:datalink/Snapshot.jpg")
- For display, images can be applied to areas by setting the CSS property background-image to: "datalink/Snapshot.jpg"
Example Setup for Images using a Soft Link
This example covers the scenario where a user has a set of logos and needs PhixFlow to display them based on the Business currently selected.
Step1: Setup the soft link
See Configuring Soft Links Between PhixFlow and Tomcat for the commands
Example locations are shown below:
Operating System | Source (Tomcat) | Target (Directory) |
---|---|---|
Linux | <path>/tomcat/webapps/phixflow/datalink |
|
Windows | <path>\tomcat\webapps\phixflow\ | <path>/phixflow/ |
Step 2: Upload Images
The business logos should be uploaded onto the server into the Target directory using the appropriate protocol e.g. FTP.
It should be noted it is a good idea to create subdirectories under the Target directory for different types of information i.e. "customImages" for the customer logos we are uploading.
In this example we will upload our images to: <path>/phixflow/data/datalink/customImages.
Step 3: Display an Images
Anchor | ||||
---|---|---|---|---|
|
In your PhixFlow application, to display an image stored on the PhixFlow server, use the URL for it's location, for example: url("https:datalink/MyProject/MyImage.png").
For example, you can configure the following CSS Properties to use an image stored on the PhixFlow server as a background image.
...
It is assumed that a table exists which contains the names of the Business logos. For example a Businesses table with an attribute called LogoName that holds the name of the business's logo.
Setup
- Create a new screen
- Open the palette and add one of the Complete Screens to the screen by dragging and dropping it.
- Open the table containing the names of the customer logo e.g. Businesses
- Drag the attribute containing the logo name onto the screen e.g. LogoName.
- Setting the background image
- In the palette find the Area component and drag it onto the screen.
- Navigate to its Style Tab and set the following:
- Background Repeat: no-repeat
- Background Size: 100%
- See Image Sizing for more information on this.
- In the CSS Properties section, click the add button and set the following:
- CSS Tag: background-Image
- Value: "datalink/customerImages"+_form.LogoName
- If you are obtaining the logo name from an attribute on a grid or card component, these can be referenced using:
- Grid: _selected. AttributeName
- Card Component: _current.AttributeName
- Expression: Tick
- Save all changes
- The image should now display inside the Area component.