activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1128063 - in /activemq/activemq-apollo/trunk/apollo-web/src/main: scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala webapp/WEB-INF/org/apache/activemq/apollo/web/resources/EditConfig.jade
Date Thu, 26 May 2011 20:29:31 GMT
Author: chirino
Date: Thu May 26 20:29:30 2011
New Revision: 1128063

URL: http://svn.apache.org/viewvc?rev=1128063&view=rev
Log:
Simpler config resource handling.

Modified:
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/web/resources/EditConfig.jade

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala?rev=1128063&r1=1128062&r2=1128063&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
Thu May 26 20:29:30 2011
@@ -22,13 +22,13 @@ import Response.Status._
 import org.apache.activemq.apollo.broker.ConfigStore
 import org.apache.activemq.apollo.dto.{XmlCodec, BrokerDTO, ValueDTO}
 import org.fusesource.hawtbuf._
+import com.sun.jersey.api.view.ImplicitProduces
 
 case class EditConfig(config:String)
 
 /**
  * A broker resource is used to represent the configuration of a broker.
  */
-@Produces(Array("application/json", "application/xml","text/xml", "text/html;qs=5"))
 case class ConfigurationResource(parent:BrokerResource, dto:BrokerDTO) extends Resource(parent)
{
 
   lazy val store = {
@@ -41,10 +41,29 @@ case class ConfigurationResource(parent:
   }
 
   @GET
-  def get() = store.load(false)
+  @Produces(Array("text/plain"))
+  def get() = store.read
+
+  @PUT
+  def put( config:String):Unit = {
+    store.write(config)
+  }
+
+  @POST
+  def edit_post(@FormParam("config") config:String) = {
+    put(config)
+    result(uri_info.getAbsolutePathBuilder().build())
+  }
+
+  @GET
+  @Produces(Array("text/html"))
+  def edit_html() = {
+    EditConfig(store.read)
+  }
 
   @GET
   @Path("runtime")
+  @Produces(Array("application/json", "application/xml","text/xml"))
   def runtime = {
 
     // Encode/Decode the runtime config so that we can get a copy that
@@ -62,36 +81,5 @@ case class ConfigurationResource(parent:
     copy
   }
 
-  @Produces(Array("text/html"))
-  @GET
-  @Path("edit")
-  def edit_html() = {
-    EditConfig(store.read)
-  }
-
-  @POST
-  @Path("edit")
-  def edit_post(@FormParam("config") config:String) = {
-    val rc = new ValueDTO
-    rc.value = config
-    edit_put(rc)
-    result(path("../.."))
-  }
-
-  @Produces(Array("application/json", "application/xml","text/xml"))
-  @GET
-  @Path("edit")
-  def edit() = {
-    val rc = new ValueDTO
-    rc.value = store.read
-    rc
-  }
-
-  @PUT
-  @Path("edit")
-  def edit_put(config:ValueDTO) = {
-    store.write(config.value)
-  }
-
 }
 

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/web/resources/EditConfig.jade
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/web/resources/EditConfig.jade?rev=1128063&r1=1128062&r2=1128063&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/web/resources/EditConfig.jade
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/web/resources/EditConfig.jade
Thu May 26 20:29:30 2011
@@ -20,7 +20,7 @@
 .breadcumbs
   a(href={strip_resolve("../..")}) Back
 
-form(method="post" action="edit")
+form(method="post" action="config")
   div
     input(type="submit" value="Update")
   div



Mime
View raw message