activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1348055 - in /activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web: JerseyServlet.scala resources/BrokerResource.scala resources/Support.scala
Date Fri, 08 Jun 2012 13:03:41 GMT
Author: chirino
Date: Fri Jun  8 13:03:41 2012
New Revision: 1348055

URL: http://svn.apache.org/viewvc?rev=1348055&view=rev
Log:
Fixes APLO-208 : Incorrect REST status returned on DELETE

Modified:
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServlet.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServlet.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServlet.scala?rev=1348055&r1=1348054&r2=1348055&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServlet.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServlet.scala
Fri Jun  8 13:03:41 2012
@@ -59,7 +59,7 @@ class JerseyServlet extends ServletConta
     original_config = config
     custom_config_map.put("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.ClassNamesResourceConfig")
     custom_config_map.put("com.sun.jersey.config.property.classnames", WebModule.web_resources.map(_.getName).mkString("
"))
-    custom_config_map.put("com.sun.jersey.config.feature.Trace", System.getProperty("com.sun.jersey.config.feature.Trace",
"true"))
+    custom_config_map.put("com.sun.jersey.config.feature.Trace", System.getProperty("com.sun.jersey.config.feature.Trace",
"false"))
     custom_config_map.put("com.sun.jersey.spi.container.ContainerRequestFilters", "com.sun.jersey.api.container.filter.PostReplaceFilter")
     custom_config_map.put("com.sun.jersey.config.feature.Redirect", "true")
     custom_config_map.put("com.sun.jersey.config.feature.FilterForwardOn404", "true")

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala?rev=1348055&r1=1348054&r2=1348055&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
Fri Jun  8 13:03:41 2012
@@ -581,7 +581,7 @@ class BrokerResource() extends Resource 
   @DELETE @Path("/virtual-hosts/{id}/queues/{name:.*}")
   @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML))
   @ApiOperation(value = "Deletes the named queue.")
-  def queue_delete(@PathParam("id") id : String, @PathParam("name") name : String):Unit =
unwrap_future_result {
+  def queue_delete(@PathParam("id") id : String, @PathParam("name") name : String) = ok {
     with_virtual_host(id) { host =>
       val router: LocalRouter = host
       val node = router.local_queue_domain.destination_by_id.get(name).getOrElse(result(NOT_FOUND))
@@ -595,7 +595,7 @@ class BrokerResource() extends Resource 
 
   @POST @Path("/virtual-hosts/{id}/queues/{name:.*}/action/delete")
   @Produces(Array("text/html;qs=5"))
-  def post_queue_delete_and_redirect(@PathParam("id") id : String, @PathParam("name") name
: String):Unit = unwrap_future_result {
+  def post_queue_delete_and_redirect(@PathParam("id") id : String, @PathParam("name") name
: String) = ok {
     queue_delete(id, name)
     result(strip_resolve("../../.."))
   }
@@ -634,7 +634,7 @@ class BrokerResource() extends Resource 
   @DELETE @Path("/virtual-hosts/{id}/dsubs/{name:.*}")
   @ApiOperation(value = "Deletes the named virtual host.")
   @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML))
-  def dsub_delete(@PathParam("id") id : String, @PathParam("name") name : String):Unit =
unwrap_future_result {
+  def dsub_delete(@PathParam("id") id : String, @PathParam("name") name : String) = ok {
     with_virtual_host(id) { host =>
       val router: LocalRouter = host
       val node = router.local_dsub_domain.destination_by_id.get(name).getOrElse(result(NOT_FOUND))
@@ -648,7 +648,7 @@ class BrokerResource() extends Resource 
 
   @POST @Path("/virtual-hosts/{id}/dsubs/{name:.*}/action/delete")
   @Produces(Array("text/html;qs=5"))
-  def post_dsub_delete_and_redirect(@PathParam("id") id : String, @PathParam("name") name
: String):Unit = unwrap_future_result {
+  def post_dsub_delete_and_redirect(@PathParam("id") id : String, @PathParam("name") name
: String) = ok {
     dsub_delete(id, name)
     result(strip_resolve("../../.."))
   }
@@ -694,7 +694,7 @@ class BrokerResource() extends Resource 
 
   @POST @Path("/connectors/{id}/action/stop")
   @ApiOperation(value = "Stops a connector.")
-  def post_connector_stop(@PathParam("id") id : String):Unit = unwrap_future_result {
+  def post_connector_stop(@PathParam("id") id : String) = ok {
     with_connector(id) { connector =>
       admining(connector.broker) {
         connector.stop(NOOP)
@@ -705,7 +705,7 @@ class BrokerResource() extends Resource 
 
   @POST @Path("/connectors/{id}/action/start")
   @ApiOperation(value = "Starts a connector.")
-  def post_connector_start(@PathParam("id") id : String):Unit = unwrap_future_result {
+  def post_connector_start(@PathParam("id") id : String) = ok {
     with_connector(id) { connector =>
       admining(connector.broker) {
         connector.start(NOOP)
@@ -774,7 +774,7 @@ class BrokerResource() extends Resource 
   @DELETE @Path("/connections/{id}")
   @ApiOperation(value = "Disconnect a connection from the broker.")
   @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML))
-  def connection_delete(@PathParam("id") id : Long):Unit = unwrap_future_result {
+  def connection_delete(@PathParam("id") id : Long) = ok {
     with_connection(id){ connection=>
       admining(connection.connector.broker) {
         connection.stop(NOOP)
@@ -786,7 +786,7 @@ class BrokerResource() extends Resource 
   @POST @Path("/connections/{id}/action/delete")
   @ApiOperation(value = "Disconnect a connection from the broker.")
   @Produces(Array("text/html;qs=5"))
-  def post_connection_delete_and_redirect(@PathParam("id") id : Long):Unit = unwrap_future_result
{
+  def post_connection_delete_and_redirect(@PathParam("id") id : Long) = ok {
     connection_delete(id)
     result(strip_resolve("../../.."))
   }
@@ -794,7 +794,7 @@ class BrokerResource() extends Resource 
   @POST
   @Path("/action/shutdown")
   @ApiOperation(value = "Shutsdown the JVM")
-  def command_shutdown:Unit = unwrap_future_result {
+  def command_shutdown = ok {
     info("JVM shutdown requested via web interface")
     with_broker { broker =>
       admining(broker) {

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala?rev=1348055&r1=1348054&r2=1348055&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
Fri Jun  8 13:03:41 2012
@@ -86,6 +86,11 @@ abstract class Resource(parent:Resource=
         http_request = value
     }
   }
+  
+  def ok[T](value:FutureResult[T]):Unit = {
+    unwrap_future_result(value)
+    throw new WebApplicationException(Response.ok().build)
+  }  
 
 
   if( parent!=null ) {



Mime
View raw message