diff --git a/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/domain/TradeResponse.java b/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/domain/TradeResponse.java index e69e325..0c845e2 100644 --- a/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/domain/TradeResponse.java +++ b/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/domain/TradeResponse.java @@ -124,8 +124,10 @@ public class TradeResponse { @Override public String toString() { - return "TradeResponse [accountName=" + accountName + ", confirmationNumber=" + confirmationNumber + ", error=" - + error + ", errorMessage=" + errorMessage + ", orderType=" + orderType + ", price=" + price + return "TradeResponse [accountName=" + accountName + ", requestId=" + + requestId + ", confirmationNumber=" + confirmationNumber + + ", error=" + error + ", errorMessage=" + errorMessage + + ", orderType=" + orderType + ", price=" + price + ", quantity=" + quantity + ", ticker=" + ticker + "]"; } diff --git a/stocks/src/main/webapp/index.jsp b/stocks/src/main/webapp/index.jsp index 0609e79..bc03f22 100644 --- a/stocks/src/main/webapp/index.jsp +++ b/stocks/src/main/webapp/index.jsp @@ -81,7 +81,8 @@ } function confirm(id) { if (lasttrades.id) { - clearTimeout(lasttrades.id) + clearTimeout(lasttrades.id); + delete lasttrades.id; } $.get("trade?requestId=" + id, function(response) { if (response && response.requestId) { @@ -90,11 +91,12 @@ })); delete lasttrades.id; } else { - lasttrades.id = setTimeout("confirm('" + id + "')", 1000); + lasttrades.id = setTimeout("confirm('" + id + "')", 2000); } }); } $(function() { + $.ajaxSetup({cache:false}); $('#start').click(start); $('#stop').click(stop); $('#clear').click(clear); @@ -109,7 +111,7 @@ function(request) { var message = "Processing..."; if (request && request.ticker) { - confirm(request.id) + confirm(request.id); } else { message = "The trade request was invalid. Please provide a quantity and a stock ticker."; }