Commits

Stephen McKamey  committed ce4d4d3

fixing conflict between ResponseBuilder and ActionTimer

  • Participants
  • Parent commits aa757c8
  • Tags v0.2.0

Comments (0)

Files changed (4)

File duel-mvcapp-archetype/src/main/resources/archetype-resources/src/main/java/aspects/ActionTimer.java

 		}
 
 		// emit a header with the timing
-		ResponseBuilder response = (result instanceof Response) ? Response.fromResponse((Response)result) : Response.ok(result);
+		ResponseBuilder response =
+			(result instanceof ResponseBuilder) ? (ResponseBuilder)result :
+			(result instanceof Response) ? Response.fromResponse((Response)result) :
+			Response.ok(result);
 		return response.header("X-Action-MS", elapsed).build();
 	}
 }

File duel-mvcapp-archetype/src/main/resources/archetype-resources/src/main/java/controllers/PingController.java

 package ${package}.controllers;
 
 import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
 import com.google.inject.*;
 
 /**
 	@Produces("text/plain")
 	public Object ping() {
 
-		// TODO: perform service health test
-		return "OK";
+		// TODO: perform service health tests
+
+		//return non-OK status to pull server from pool
+		return Response.ok("pong");
 	}
 }

File mvcapp/src/main/java/com/example/mvcapp/aspects/ActionTimer.java

 		}
 
 		// emit a header with the timing
-		ResponseBuilder response = (result instanceof Response) ? Response.fromResponse((Response)result) : Response.ok(result);
+		ResponseBuilder response =
+			(result instanceof ResponseBuilder) ? (ResponseBuilder)result :
+			(result instanceof Response) ? Response.fromResponse((Response)result) :
+			Response.ok(result);
 		return response.header("X-Action-MS", elapsed).build();
 	}
 }

File mvcapp/src/main/java/com/example/mvcapp/controllers/PingController.java

 package com.example.mvcapp.controllers;
 
 import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
 import com.google.inject.*;
 
 /**
 	@Produces("text/plain")
 	public Object ping() {
 
-		// TODO: perform service health test
-		return "OK";
+		// TODO: perform service health tests
+
+		//return non-OK status to pull server from pool
+		return Response.ok("pong");
 	}
 }