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/14 18:04:06 UTC
svn commit: r1059072 -
/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
Author: chirino
Date: Fri Jan 14 17:04:06 2011
New Revision: 1059072
URL: http://svn.apache.org/viewvc?rev=1059072&view=rev
Log:
better webapp location detection.
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=1059072&r1=1059071&r2=1059072&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 Fri Jan 14 17:04:06 2011
@@ -74,34 +74,37 @@ object JettyWebServer extends Log {
// 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
- }
- }
- }
+ var url = JettyWebServer.getClass.getClassLoader.getResource("META-INF/apollo-web.txt")
- // 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"
+ if( url.getProtocol == "jar") {
+
+ // we are probably being run from a maven build..
+ url = new java.net.URL( url.getFile.stripSuffix("!/META-INF/apollo-web.txt") )
+ val jar = new File( url.getFile )
+ if( jar.isFile ) {
+ jar.getParentFile / (jar.getName.stripSuffix(".jar")+".war")
+ } else {
+ null
+ }
+
+ } else if( url.getProtocol == "file") {
+
+ // we are probably being run from an IDE...
+ val rc = new File( url.getFile.stripSuffix("/META-INF/apollo-web.txt") )
+ if( rc.isDirectory ) {
+ rc/".."/".."/"src"/"main"/"webapp"
+ } else {
+ null
+ }
} else {
null
}
+
}
}
-
rc
}