Changeset 641
- Timestamp:
- 04/05/11 18:56:13 (2 years ago)
- Location:
- raptor-mua/trunk/src/main
- Files:
-
- 1 added
- 2 edited
-
config/jetty.xml (modified) (2 diffs)
-
config/server.properties (added)
-
java/uk/ac/cardiff/raptormua/server/RunServer.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
raptor-mua/trunk/src/main/config/jetty.xml
r638 r641 6 6 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> 7 7 8 <!-- Bean that enables java system properties --> 9 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > 10 <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> 11 </bean> 12 13 14 <!-- The Jetty Server configuration, You DO NOT need to adjust values below this point --> 8 15 <bean id="Server" 9 16 class="org.mortbay.jetty.Server" init-method="start" destroy-method="stop"> … … 27 34 <bean class="org.mortbay.jetty.webapp.WebAppContext"> 28 35 <property name="contextPath" value="/MUA"/> 29 <property name="war" value=" target/conf">30 < /property>36 <property name="war" value="${user.dir}/target/conf"/> 37 <property name="descriptor" value="${user.dir}/target/conf/web.xml"/> 31 38 </bean> 32 39 </list> -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/server/RunServer.java
r638 r641 17 17 18 18 import java.io.File; 19 import java.io.FileInputStream; 20 import java.io.FileNotFoundException; 21 import java.io.IOException; 19 22 import java.net.URL; 20 23 import java.security.ProtectionDomain; 24 import java.util.Properties; 21 25 22 26 import javax.xml.ws.Endpoint; … … 46 50 public class RunServer { 47 51 48 /** 49 * Programmatically start a Jetty Server instance, and set the web.xml in the 50 * configuration directory to initialise the servlet. 51 * 52 * @param args 53 * @throws Exception 54 */ 55 public static void main(String args[]) { 52 /** 53 * Programmatically start a Jetty Server instance, and set the web.xml in the configuration directory to initialise the servlet. 54 * 55 * @param args 56 * @throws IOException 57 * @throws FileNotFoundException 58 * @throws Exception 59 */ 60 public static void main(String args[]) throws FileNotFoundException, IOException { 56 61 57 String configurationFiles = System.getProperty("configurationFiles", System.getProperty("user.dir") 58 + "/target/conf"); 59 int portNumber = Integer.parseInt(System.getProperty("port", "8080")); 62 String configurationFiles = System.getProperty("configurationFiles", System.getProperty("user.dir") + "/target/conf"); 60 63 61 System.out.println("[INFO] Jetty Config: Using Port " + portNumber);62 System.out.println("[INFO] Servlet and Spring Config: Configuration files at " + configurationFiles);64 Properties props = new Properties(); 65 props.load(new FileInputStream(configurationFiles + "/server.properties")); 63 66 64 Server server = new Server(); 65 66 SslSocketConnector sslConnector = new SslSocketConnector(); 67 sslConnector.setPort(8443); 68 sslConnector.setMaxIdleTime(30000); 69 sslConnector.setKeystore("/home/philsmart/Downloads/jetty-distribution-7.2.2.v20101205/etc/keystore"); 70 sslConnector.setPassword("changeit"); 71 sslConnector.setKeyPassword("changeit"); 72 sslConnector.setTruststore("/home/philsmart/Downloads/jetty-distribution-7.2.2.v20101205/etc/keystore"); 73 sslConnector.setTrustPassword("changeit"); 74 75 SocketConnector connector = new SocketConnector(); 76 connector.setPort(portNumber); 77 connector.setMaxIdleTime(30000); 78 connector.setConfidentialPort(8443); 67 int portNumber = Integer.parseInt(props.getProperty("jetty.port", "8443")); 68 String keyStoreLocaion = props.getProperty("jetty.keyStoreLocation", ""); 69 String keyStorePassword = props.getProperty("jetty.keyStorePassword", "changeit"); 70 String trustStoreLocaion = props.getProperty("jetty.trustStoreLocaion", ""); 71 String trustStorePassword = props.getProperty("jetty.trustStorePassword", "changeit"); 72 String webappContextPath = props.getProperty("jetty.webapp.contextPath", "/MUA"); 79 73 80 server.setConnectors(new Connector[]{connector, sslConnector}); 81 82 WebAppContext webappcontext = new WebAppContext(); 83 webappcontext.setDescriptor(configurationFiles+"/web.xml"); 84 webappcontext.setContextPath("/MUA"); 85 webappcontext.setWar(configurationFiles); 86 87 HandlerCollection handlers= new HandlerCollection(); 88 handlers.setHandlers(new Handler[]{webappcontext, new DefaultHandler()}); 74 System.out.println("[INFO] Jetty Config: Using Port " + portNumber); 75 System.out.println("[INFO] Servlet and Spring Config: Configuration files at " + configurationFiles); 89 76 90 server.setHandler(handlers); 91 try { 92 server.start(); 93 server.join(); 94 } catch (Exception e) { 95 e.printStackTrace(); 96 System.exit(100); 97 } 77 Server server = new Server(); 98 78 79 SslSocketConnector sslConnector = new SslSocketConnector(); 80 sslConnector.setPort(portNumber); 81 sslConnector.setMaxIdleTime(30000); 82 sslConnector.setKeystore(keyStoreLocaion); 83 sslConnector.setPassword(keyStorePassword); 84 sslConnector.setKeyPassword(keyStorePassword); 85 sslConnector.setTruststore(trustStoreLocaion); 86 sslConnector.setTrustPassword(trustStorePassword); 87 88 server.setConnectors(new Connector[] { sslConnector }); 89 90 WebAppContext webappcontext = new WebAppContext(); 91 webappcontext.setDescriptor(configurationFiles+"/web.xml"); 92 webappcontext.setContextPath(webappContextPath); 93 webappcontext.setWar(configurationFiles); 94 95 HandlerCollection handlers = new HandlerCollection(); 96 handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() }); 97 98 server.setHandler(handlers); 99 100 try { 101 server.start(); 102 server.join(); 103 } catch (Exception e) { 104 e.printStackTrace(); 105 System.exit(100); 99 106 } 100 107 108 } 109 101 110 }
Note: See TracChangeset
for help on using the changeset viewer.
