activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1492820 - in /activemq/activemq-apollo/trunk: ./ apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/ apollo-jmx/src/main/scala/org/apache/activemq/apollo/broke...
Date Thu, 13 Jun 2013 18:53:49 GMT
Author: chirino
Date: Thu Jun 13 18:53:49 2013
New Revision: 1492820

URL: http://svn.apache.org/r1492820
Log:
Tweaks needed to get the Apollo working nicer with hawtio

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1492820&r1=1492819&r2=1492820&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
Thu Jun 13 18:53:49 2013
@@ -667,11 +667,11 @@ class Broker() extends BaseService with 
 
   }
 
-  def web_admin_url = {
-    if( config.web_admins.isEmpty ) {
+  def web_admin_url:String = {
+    if( web_server == null ) {
       null
     } else {
-      config.web_admins.get(0).bind
+      web_server.uris().headOption.map(_.toString.stripSuffix("/")).getOrElse(null)
     }
   }
 

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala?rev=1492820&r1=1492819&r2=1492820&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala
Thu Jun 13 18:53:49 2013
@@ -31,11 +31,20 @@ class AllowAnyOriginFilter(val allowed:S
   override def init(filterConfig: FilterConfig) {}
   override def destroy() = {}
 
-  override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain)
= {
+  override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain):Unit
= {
     response match {
       case response: HttpServletResponse =>
         val req = request.asInstanceOf[HttpServletRequest]
-        if( allow_any ) {
+        val origin = request.asInstanceOf[HttpServletRequest].getHeader("Origin")
+
+        if( allow_any || allowed.contains(origin) ) {
+
+          if( origin !=null ) {
+            response.addHeader("Access-Control-Allow-Origin", origin);
+          } else {
+            response.addHeader("Access-Control-Allow-Origin", "*");
+          }
+
           if ( req.getMethod == "OPTIONS" ) {
             response.addHeader("Access-Control-Request-Method", "GET, POST, PUT, DELETE");
             req.getHeader("Access-Control-Request-Headers") match {
@@ -44,22 +53,8 @@ class AllowAnyOriginFilter(val allowed:S
             }
             response.addHeader("Access-Control-Max-Age", ""+DAYS.toSeconds(1));
           }
-          response.addHeader("Access-Control-Allow-Origin", "*");
-        } else {
-          for( origin <- Option(request.asInstanceOf[HttpServletRequest].getHeader("Origin"))
) {
-            if ( allowed.contains(origin) ) {
-              if ( req.getMethod == "OPTIONS" ) {
-                response.addHeader("Access-Control-Request-Method", "GET, POST, PUT, DELETE");
-                req.getHeader("Access-Control-Request-Headers") match {
-                  case headers:String=> response.addHeader("Access-Control-Allow-Headers",
headers);
-                  case _ =>
-                }
-                response.addHeader("Access-Control-Max-Age", ""+DAYS.toSeconds(1));
-              }
-              response.addHeader("Access-Control-Allow-Origin", origin);
-            }
-          }
         }
+
       case _ =>
     }
     chain.doFilter(request, response)

Modified: activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala?rev=1492820&r1=1492819&r2=1492820&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
Thu Jun 13 18:53:49 2013
@@ -36,13 +36,26 @@ import org.fusesource.hawtdispatch._
  */
 
 @Path("/hawtio/jolokia")
-@Produces(Array(APPLICATION_JSON))
+@Produces(Array(APPLICATION_JSON, "text/json"))
 class JolokiaResource extends JmxResource
 
-@Path("/jmx")
-@Produces(Array(APPLICATION_JSON))
+@Path("/jmx/")
+@Produces(Array(APPLICATION_JSON, "text/json"))
 class JmxResource extends Resource {
 
+  @GET
+  def get(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse)
= invoke(ctx, req, resp, "")
+  @POST
+  def post(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse)
= invoke(ctx, req, resp, "")
+  @PUT
+  def put(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse)
= invoke(ctx, req, resp, "")
+  @DELETE
+  def delete(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse)
= invoke(ctx, req, resp, "")
+  @OPTIONS
+  def options(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse)
= invoke(ctx, req, resp, "")
+  @HEAD
+  def head(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse)
= invoke(ctx, req, resp, "")
+
   @GET @Path("{path:.*}")
   def get(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse,
@PathParam("path") path:String) = invoke(ctx, req, resp, path)
   @POST @Path("{path:.*}")

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1492820&r1=1492819&r2=1492820&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Thu Jun 13 18:53:49 2013
@@ -118,7 +118,7 @@
     <jersey-version>1.7</jersey-version>
     <snakeyaml-version>1.7</snakeyaml-version>
     <swagger-version>1.2.0</swagger-version>
-    <jolokia-version>1.0.6</jolokia-version>
+    <jolokia-version>1.1.1</jolokia-version>
 
     <selenium-version>2.33.0</selenium-version>
       



Mime
View raw message