[Red5commits] [2404] support passing of virtual hosts when deploying app

jbauch luke at codegent.com
Tue Oct 16 15:50:09 PDT 2007


support passing of virtual hosts when deploying app


Timestamp: 10/16/07 17:45:29 EST (less than one hour ago) 
Change: 2404 
Author: jbauch

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/api/IApplicationLoader.java
java/server/trunk/src/org/red5/server/jetty/JettyApplicationLoader.java
java/server/trunk/src/org/red5/server/tomcat/TomcatApplicationLoader.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/2404

Index: /java/server/trunk/src/org/red5/server/tomcat/TomcatApplicationLoader.java
===================================================================
--- /java/server/trunk/src/org/red5/server/tomcat/TomcatApplicationLoader.java (revision 2186)
+++ /java/server/trunk/src/org/red5/server/tomcat/TomcatApplicationLoader.java (revision 2404)
@@ -52,9 +52,10 @@
 	
 	/** {@inheritDoc} */
-	public void loadApplication(String contextPath, String directory)
+	public void loadApplication(String contextPath, String virtualHosts, String directory)
 			throws Exception {
 		if (directory.startsWith("file:")) {
 			directory = directory.substring(5);
 		}
+		// TODO: evaluate virtual hosts
 		Context c = embedded.createContext(contextPath, directory);
 		LoaderBase.setRed5ApplicationContext(contextPath, new TomcatApplicationContext(c));
Index: /java/server/trunk/src/org/red5/server/jetty/JettyApplicationLoader.java
===================================================================
--- /java/server/trunk/src/org/red5/server/jetty/JettyApplicationLoader.java (revision 2397)
+++ /java/server/trunk/src/org/red5/server/jetty/JettyApplicationLoader.java (revision 2404)
@@ -52,5 +52,5 @@
 	
 	/** {@inheritDoc} */
-	public void loadApplication(String contextPath, String directory) throws Exception {
+	public void loadApplication(String contextPath, String virtualHosts, String directory) throws Exception {
 		String[] handlersArr = new String[] {
 				"org.mortbay.jetty.webapp.WebInfConfiguration",
@@ -61,5 +61,20 @@
 
 		WebAppContext context = new WebAppContext();
+        // Get hostnames
+        String[] hostnames = null;
+        if (virtualHosts != null) {
+        	hostnames = virtualHosts.split(",");
+    		for (int i = 0; i < hostnames.length; i++) {
+    			hostnames[i] = hostnames[i].trim();
+    			if (hostnames[i].equals("*")) {
+    				// A virtual host "null" must be used so requests for
+    				// any host will be served.
+    				hostnames = null;
+    				break;
+    			}
+    		}
+        }
 		context.setContextPath(contextPath);
+		context.setVirtualHosts(hostnames);
 		context.setConfigurationClasses(handlersArr);
 		context.setDefaultsDescriptor("web-default.xml");
Index: /java/server/trunk/src/org/red5/server/api/IApplicationLoader.java
===================================================================
--- /java/server/trunk/src/org/red5/server/api/IApplicationLoader.java (revision 2165)
+++ /java/server/trunk/src/org/red5/server/api/IApplicationLoader.java (revision 2404)
@@ -31,9 +31,10 @@
 	 * Load a new application for the given context path from a directory.
 	 * 
-	 * @param context
+	 * @param contextPath
+	 * @param virtualHosts
 	 * @param directory
 	 * @throws Exception
 	 */
-	public void loadApplication(String contextPath, String directory) throws Exception;
+	public void loadApplication(String contextPath, String virtualHosts, String directory) throws Exception;
 	
 }


Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list