You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2011/01/13 18:17:41 UTC
svn commit: r1058670 - in /activemq/activemq-apollo/trunk:
apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/
apollo-web/src/main/resources/META-INF/ apollo-web/src/main/webapp/WEB-INF/
Author: chirino
Date: Thu Jan 13 17:17:41 2011
New Revision: 1058670
URL: http://svn.apache.org/viewvc?rev=1058670&view=rev
Log:
Be smarter about auto detecting where the webapp module is located if the apollo.home system properties are not set.
Added:
activemq/activemq-apollo/trunk/apollo-web/src/main/resources/META-INF/
activemq/activemq-apollo/trunk/apollo-web/src/main/resources/META-INF/apollo-web.txt
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/apollo-web.txt
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala?rev=1058670&r1=1058669&r2=1058670&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala Thu Jan 13 17:17:41 2011
@@ -59,15 +59,50 @@ object JettyWebServer extends Log {
val webapp = {
import FileSupport._
- val x = System.getProperty("apollo.webapp")
- if( x != null ) {
- new File(x)
- } else {
- (Option(System.getProperty("apollo.home")).flatMap { home=>
+ var rc:File = null
+
+ Option(System.getProperty("apollo.webapp")).foreach{ x=>
+ rc = new File(x)
+ }
+
+ if( rc==null ) {
+ Option(System.getProperty("apollo.home")).foreach { home=>
val lib = new File(home) / "lib"
- lib.list.find( _.matches("""apollo-web-.+-slim.war""")).map(lib / _)
- }).getOrElse(null)
+ rc = lib.list.find( _.matches("""apollo-web-.+-slim.war""")).map(lib / _).getOrElse(null)
+ }
}
+
+ // the war might be on the classpath..
+ if( rc==null ) {
+ val url = JettyWebServer.getClass.getClassLoader.getResource("WEB-INF/apollo-web.txt")
+ rc = if(url== null) {
+ null
+ } else {
+ val rc = new File( url.getFile.stripSuffix("!/WEB-INF/apollo-web.txt") )
+ if( rc.isFile ) {
+ rc
+ } else {
+ null
+ }
+ }
+ }
+
+ // the war project source module might be on the classpath (being run from an IDE)
+ if( rc==null ) {
+ val url = JettyWebServer.getClass.getClassLoader.getResource("META-INF/apollo-web.txt")
+ rc = if(url==null) {
+ null
+ } else {
+ val rc = new File( url.getFile.stripSuffix("/META-INF/apollo-web.txt") )
+ if( rc.isDirectory ) {
+ rc/".."/".."/"src"/"main"/"webapp"
+ } else {
+ null
+ }
+ }
+ }
+
+ rc
}
}
Added: activemq/activemq-apollo/trunk/apollo-web/src/main/resources/META-INF/apollo-web.txt
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/resources/META-INF/apollo-web.txt?rev=1058670&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/resources/META-INF/apollo-web.txt (added)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/resources/META-INF/apollo-web.txt Thu Jan 13 17:17:41 2011
@@ -0,0 +1 @@
+This is just a marker file so we can find the war if it's in the classpath.
\ No newline at end of file
Added: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/apollo-web.txt
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/apollo-web.txt?rev=1058670&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/apollo-web.txt (added)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/apollo-web.txt Thu Jan 13 17:17:41 2011
@@ -0,0 +1 @@
+This is just a marker file so we can find the war if it's in the classpath.
\ No newline at end of file