File transfer

The restConnector-2.0 feature includes the FileTransfer and FileService MBeans. The FileTransfer MBean supports delete, upload, and download operations to and from a running Liberty server. The FileService MBean provides access to directory lists and file metadata, and it also provides archive operations such as create and expand.

The FileTransfer and FileService MBeans are useful for carrying out remote operations on Liberty, such as updating the configuration or installing an application. A configuration update can be performed remotely by uploading an updated server.xml file for the target Liberty server. An application can be installed by uploading both the application archive and an updated server.xml file or simply by uploading the application archive to the monitored dropins folder.

The FileTransfer MBean includes configurable read and write lists so that you can control the directories that can be read or written when using the FileTransfer MBean.

See the section on the FileTransfer MBean in List of provided MBeans for information on how to configure the restConnector-2.0 feature and control the FileTransfer MBean read and write lists.

The uploadFile method from FileTransfer contains a boolean called "expandOnCompletion" that allows a user to upload and expand the archive with a single MBean invocation. A directory is created with the same name as the archive on the target path and the FileService MBean is automatically invoked to expand the archive.

Example: A call to uploadFile with parameters {"C:/temp/", "${server.output.dir}/", true} will result in a directory under ${server.output.dir} that contains the extracted contents of the archive being created.