[infinispan-commits] Infinispan SVN: r1269 - in trunk/server/rest: src/main/scala/org/infinispan/rest and 2 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Thu Dec 10 01:35:11 EST 2009
Author: michael.neale at jboss.com
Date: 2009-12-10 01:35:10 -0500 (Thu, 10 Dec 2009)
New Revision: 1269
Modified:
trunk/server/rest/pom.xml
trunk/server/rest/src/main/scala/org/infinispan/rest/StartupListener.scala
trunk/server/rest/src/main/webapp/index.html
trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala
Log:
ISPN-281 Server is now configurable outside of the war. Also updated the doco and the RESTEasy version for good measure (it is now latest, at time of writing).
Modified: trunk/server/rest/pom.xml
===================================================================
--- trunk/server/rest/pom.xml 2009-12-09 19:33:18 UTC (rev 1268)
+++ trunk/server/rest/pom.xml 2009-12-10 06:35:10 UTC (rev 1269)
@@ -79,7 +79,7 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.1.GA</version>
+ <version>1.2.GA</version>
</dependency>
<dependency>
Modified: trunk/server/rest/src/main/scala/org/infinispan/rest/StartupListener.scala
===================================================================
--- trunk/server/rest/src/main/scala/org/infinispan/rest/StartupListener.scala 2009-12-09 19:33:18 UTC (rev 1268)
+++ trunk/server/rest/src/main/scala/org/infinispan/rest/StartupListener.scala 2009-12-10 06:35:10 UTC (rev 1269)
@@ -10,12 +10,20 @@
* requests are attempted to be serviced. Less kitten carnage.
*/
class StartupListener extends ServletContextListener {
+ val INFINISPAN_CONF = "infinispan.server.rest.cfg"
def contextInitialized(ev: ServletContextEvent) = {
- // Start with the default config (LOCAL mode!) TODO - add the ability to specify a config file when deploying (ISPN-281)
- ManagerInstance.instance = new DefaultCacheManager()
+
+ ManagerInstance.instance = makeCacheManager(ev)
ManagerInstance.instance.start
}
- def contextDestroyed(ev: ServletContextEvent) = {
- ManagerInstance.instance.stop
- }
+ def contextDestroyed(ev: ServletContextEvent) = ManagerInstance.instance.stop
+
+ /** Prefer the system property, but also allow the servlet context to set the path to the config */
+ def makeCacheManager(ev: ServletContextEvent) =
+ (System.getProperty(INFINISPAN_CONF), ev.getServletContext.getAttribute(INFINISPAN_CONF)) match {
+ case (s: String, null) => new DefaultCacheManager(s)
+ case (null, s: String) => new DefaultCacheManager(s)
+ case _ => new DefaultCacheManager //fall back to LOCAL mode
+ }
+
}
\ No newline at end of file
Modified: trunk/server/rest/src/main/webapp/index.html
===================================================================
--- trunk/server/rest/src/main/webapp/index.html 2009-12-09 19:33:18 UTC (rev 1268)
+++ trunk/server/rest/src/main/webapp/index.html 2009-12-10 06:35:10 UTC (rev 1269)
@@ -42,7 +42,7 @@
<h4>
Configuration</h4> <!-- class="proj_define" FOR BOX EFFECT -->
<p>
- Out of the box, Infinispan will give you distributed caching - however, to change the defauls, locate the infinispan-config.xml in the web-app, and customise.
+ Out of the box, Infinispan will use its LOCAL mode cache. To set a custom configuration, create an infinispan config file (xml) and set it as either the System property called "infinispan.server.rest.cfg" (without quotes, obviously) or a web context attribute of the same name. The value should be a path to your config file (eg on the command line: -Dinfinispan.server.rest.cfg=/somewhere/infinispan.xml)
</div><div style="clear: both;"></div><div id="commonContent" >
<h5>
Modified: trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala
===================================================================
--- trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala 2009-12-09 19:33:18 UTC (rev 1268)
+++ trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala 2009-12-10 06:35:10 UTC (rev 1269)
@@ -254,10 +254,6 @@
assertEquals("application/json", get3.getResponseHeader("Content-Type").getValue)
- get3.setRequestHeader("Accept", "*/*")
- Client.call(get3)
- assertEquals(HttpServletResponse.SC_NOT_ACCEPTABLE, get3.getStatusCode)
-
}
More information about the infinispan-commits
mailing list