1 10 11 package org.nanocontainer.testmodel; 12 13 import java.io.File ; 14 import java.io.FileInputStream ; 15 import java.io.IOException ; 16 import java.util.PropertyResourceBundle ; 17 import java.util.ResourceBundle ; 18 19 public class ResourceBundleWebServerConfig implements WebServerConfig { 20 21 String host = "localhost"; 22 int port = 8080; 23 24 public ResourceBundleWebServerConfig() throws IOException { 25 26 File file = new File (System.getProperty("basedir"), "ResourceBundleWebServerConfig.properties"); 27 if (file.exists()) { 29 ResourceBundle bundle = new PropertyResourceBundle (new FileInputStream (file)); 30 host = bundle.getString("host"); 31 port = Integer.parseInt(bundle.getString("port")); 32 } 33 } 34 35 public String getHost() { 36 return host; 37 } 38 39 public int getPort() { 40 return port; 41 } 42 43 } 44 | Popular Tags |