Search in sources :

Example 1 with FileManagerProvider

use of com.opensymphony.xwork2.config.FileManagerProvider in project struts by apache.

the class Dispatcher method init_FileManager.

private void init_FileManager() throws ClassNotFoundException {
    if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER)) {
        final String fileManagerClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER);
        final Class<FileManager> fileManagerClass = (Class<FileManager>) Class.forName(fileManagerClassName);
        LOG.info("Custom FileManager specified: {}", fileManagerClassName);
        configurationManager.addContainerProvider(new FileManagerProvider(fileManagerClass, fileManagerClass.getSimpleName()));
    } else {
        // add any other Struts 2 provided implementations of FileManager
        configurationManager.addContainerProvider(new FileManagerProvider(JBossFileManager.class, "jboss"));
    }
    if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY)) {
        final String fileManagerFactoryClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY);
        final Class<FileManagerFactory> fileManagerFactoryClass = (Class<FileManagerFactory>) Class.forName(fileManagerFactoryClassName);
        LOG.info("Custom FileManagerFactory specified: {}", fileManagerFactoryClassName);
        configurationManager.addContainerProvider(new FileManagerFactoryProvider(fileManagerFactoryClass));
    }
}
Also used : FileManagerFactory(com.opensymphony.xwork2.FileManagerFactory) JBossFileManager(org.apache.struts2.util.fs.JBossFileManager) FileManagerFactoryProvider(com.opensymphony.xwork2.config.FileManagerFactoryProvider) FileManager(com.opensymphony.xwork2.FileManager) JBossFileManager(org.apache.struts2.util.fs.JBossFileManager) FileManagerProvider(com.opensymphony.xwork2.config.FileManagerProvider)

Aggregations

FileManager (com.opensymphony.xwork2.FileManager)1 FileManagerFactory (com.opensymphony.xwork2.FileManagerFactory)1 FileManagerFactoryProvider (com.opensymphony.xwork2.config.FileManagerFactoryProvider)1 FileManagerProvider (com.opensymphony.xwork2.config.FileManagerProvider)1 JBossFileManager (org.apache.struts2.util.fs.JBossFileManager)1