activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1230596 - /activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JaxrsExceptionMapper.scala
Date Thu, 12 Jan 2012 15:39:37 GMT
Author: chirino
Date: Thu Jan 12 15:39:36 2012
New Revision: 1230596

URL: http://svn.apache.org/viewvc?rev=1230596&view=rev
Log:
Fixes issue with CSS not being served up properly.

Modified:
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JaxrsExceptionMapper.scala

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JaxrsExceptionMapper.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JaxrsExceptionMapper.scala?rev=1230596&r1=1230595&r2=1230596&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JaxrsExceptionMapper.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JaxrsExceptionMapper.scala
Thu Jan 12 15:39:36 2012
@@ -42,9 +42,7 @@ class JaxrsExceptionMapper extends Excep
     http_request.getRequestURI + Option(query).map("?"+_).getOrElse("")
   }
 
-  @Produces(Array(APPLICATION_JSON, APPLICATION_XML, TEXT_XML))
   def toResponse(error: Throwable): Response = {
-
     def response(status: Response.Status, msg: String=null) = {
       val response = Response.status(status)
       var dto = new ErrorDTO()
@@ -57,20 +55,25 @@ class JaxrsExceptionMapper extends Excep
 
     error match {
       case ex:WebApplicationException =>
-        var code = ex.getResponse.getStatus
-        if(code >= 400 && code != 401) {
-          if(ex.getResponse.getStatus >= 500) {
-            Resource.warn(ex, "HTTP request from '%s' for %s '%s' caused internal server
error: %s", http_request.getRemoteAddr, http_request.getMethod, requested_uri, ex.toString);
-          }
-          var status = Status.fromStatusCode(ex.getResponse.getStatus)
-          ex.getResponse.getEntity match {
-            case null => response(status)
-            case x:String => response(status, x)
-            case _ => ex.getResponse
-          }
-        } else {
+        if ( ! http_request.getServletPath.startsWith("/broker") ) {
           ex.getResponse
+        } else {
+          var code = ex.getResponse.getStatus
+          if(code >= 400 && code != 401) {
+            if(ex.getResponse.getStatus >= 500) {
+              Resource.warn(ex, "HTTP request from '%s' for %s '%s' caused internal server
error: %s", http_request.getRemoteAddr, http_request.getMethod, requested_uri, ex.toString);
+            }
+            var status = Status.fromStatusCode(ex.getResponse.getStatus)
+            ex.getResponse.getEntity match {
+              case null => response(status)
+              case x:String => response(status, x)
+              case _ => ex.getResponse
+            }
+          } else {
+            ex.getResponse
+          }
         }
+
       case ex:Throwable =>
         Resource.warn(ex, "HTTP request from '%s' for %s '%s' caused internal server error:
%s", http_request.getRemoteAddr, http_request.getMethod, requested_uri, ex.toString);
         response(INTERNAL_SERVER_ERROR, ex.toString)



Mime
View raw message