com.addc.server.commons.tomcat.ServerPropertySource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of addc-svr-tomcat Show documentation
Show all versions of addc-svr-tomcat Show documentation
Classes for running an embedded Tomcat 8 Service
package com.addc.server.commons.tomcat;
import java.io.IOException;
import java.util.Properties;
import org.apache.tomcat.util.IntrospectionUtils.PropertySource;
import com.addc.commons.properties.PropertiesLoader;
/**
* The ServerPropertySource supplies a properties source for the embedded tomcat
* which reads the tomcat.properties file at creation
*/
public class ServerPropertySource implements PropertySource {
private Properties props;
/**
* Create new PlayPropertySource from the file "classpath:tomcat.properties"
*
* @throws IOException
* if the tomcat properties file cannot be loaded
*/
public ServerPropertySource() throws IOException {
this("classpath:tomcat.properties");
}
/**
* Create a new ServerPropertySource using the given file name
*
* @param tomcatpropsFileName
* The tomcat properties file path
* @throws IOException
* if the tomcat properties file cannot be loaded
*/
public ServerPropertySource(String tomcatpropsFileName) throws IOException {
props= PropertiesLoader.getInstance().load(tomcatpropsFileName);
}
@Override
public String getProperty(String key) {
return props.getProperty(key);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy