Media Folders
SAP Commerce allows you to create folders for organizing and managing your media. You can use the web server or application server to limit access to media files by media folder.
Media files for a web application can potentially contain security-sensitive data. Some files such as product images or animated banners, for example, should be available to all. For other files, such as internal presentations, ensure that access is granted only to authorized users. Directory-based authentication is a simple and effective means of access control.
Media items in SAP Commerce can be just about any file that can be referenced. Unlike other items such as products or users, which are pure Java objects, media items have a physical representation somewhere on the file system. They can include CSV files, images, Flash animations, ZIP files, or MP3 files.
Any media item in SAP Commerce consists of the following:
-
It is a physical file located somewhere on the application server file system
-
It is an SAP Commerce object of the Media type that holds a reference to the physical file
You can search for media by media folder in Backoffice.
Functional Principle of Media Folders
You can assign media files to media folders. Every media folder is an individual directory on the application server, and media assigned to a media folder are stored in that directory.
The physical location where media files reside depends on the application server in use. Refer to the documentation of your application server. In the SAP Commerce Server embedded Tomcat instance, the deployed media files are located in <HYBRIS_DATA_DIR>/media. The system generates the following default folders during initialization:
-
cronjob
-
impex
-
catalogsync
You may also notice the existence of the root folder. It is not a physical folder on the application server file system. It is a name associated with the main media folder of the currently activated tenant. In other words, if you are working on the master tenant, the root folder is the same as the sys_master folder.
The system prevents you from removing the root media folder as it could cause severe issues impacting various aspects of SAP Commerce, including your storefront. Use the following property to disable this behavior:
media.is.root.folder.removable=true
Media folders in an SAP Commerce installation are tenant-specific; every tenant has its own media folders. For each tenant, the system creates a directory named sys\_ <tenant> in the deployment directory of the application server. For example, if you have the media folders cronjob and impex, and the tenants: master and junit, then the deployment directory of your application server will have the following directories:
-
media
-
sys_master
-
cronjob
-
impex
-
-
sys_junit
-
cronjob
-
impex
-
-
The SAP Commerce getter and setter methods are not affected by the MediaFolder a media is in. Calling the getMedia(String) method of MediaService, for example, returns every media item that matches the search pattern, regardless of whether the item is in a media folder or not.