Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #5 from jkuipers/url-fixes

Fixed URLs without context roots and improved URL handling in controllers
  • Loading branch information...
commit 47f634f0817762d0abd2bec29b3c94c0e2dde864 2 parents 0123db1 + 3ad0e68
@abuijze abuijze authored
View
4 web-ui/src/main/java/org/axonframework/samples/trader/webui/admin/AdminController.java
@@ -69,7 +69,7 @@ public String addMoney(@PathVariable("identifier") String portfolioIdentifier,
DepositMoneyToPortfolioCommand command =
new DepositMoneyToPortfolioCommand(new UUIDAggregateIdentifier(portfolioIdentifier), amountOfMoney);
commandBus.dispatch(command);
- return "redirect:/admin/portfolio/" + portfolioIdentifier;
+ return "redirect:/admin/portfolio/{identifier}";
}
@RequestMapping(value = "/portfolio/{identifier}/item")
@@ -83,7 +83,7 @@ public String addItem(@PathVariable("identifier") String portfolioIdentifier,
orderBookIdentifier),
amount);
commandBus.dispatch(command);
- return "redirect:/admin/portfolio/" + portfolioIdentifier;
+ return "redirect:/admin/portfolio/{identifier}";
}
/* Setters */
View
28 web-ui/src/main/java/org/axonframework/samples/trader/webui/companies/CompanyController.java
@@ -82,9 +82,9 @@ public String get(Model model) {
return "company/list";
}
- @RequestMapping(value = "/{identifier}", method = RequestMethod.GET)
- public String details(@PathVariable String identifier, Model model) {
- CompanyEntry company = companyRepository.findOne(identifier);
+ @RequestMapping(value = "/{companyId}", method = RequestMethod.GET)
+ public String details(@PathVariable String companyId, Model model) {
+ CompanyEntry company = companyRepository.findOne(companyId);
OrderBookEntry bookEntry = orderBookRepository.findByCompanyIdentifier(company.getIdentifier()).get(0);
List<TradeExecutedEntry> executedTrades = tradeExecutedRepository.findByOrderBookIdentifier(bookEntry
.getIdentifier());
@@ -96,27 +96,27 @@ public String details(@PathVariable String identifier, Model model) {
}
- @RequestMapping(value = "/buy/{identifier}", method = RequestMethod.GET)
- public String buyForm(@PathVariable String identifier, Model model) {
+ @RequestMapping(value = "/buy/{companyId}", method = RequestMethod.GET)
+ public String buyForm(@PathVariable String companyId, Model model) {
addPortfolioMoneyInfoToModel(model);
BuyOrder order = new BuyOrder();
- prepareInitialOrder(identifier, order);
+ prepareInitialOrder(companyId, order);
model.addAttribute("order", order);
return "company/buy";
}
- @RequestMapping(value = "/sell/{identifier}", method = RequestMethod.GET)
- public String sellForm(@PathVariable String identifier, Model model) {
- addPortfolioItemInfoToModel(identifier, model);
+ @RequestMapping(value = "/sell/{companyId}", method = RequestMethod.GET)
+ public String sellForm(@PathVariable String companyId, Model model) {
+ addPortfolioItemInfoToModel(companyId, model);
SellOrder order = new SellOrder();
- prepareInitialOrder(identifier, order);
+ prepareInitialOrder(companyId, order);
model.addAttribute("order", order);
return "company/sell";
}
- @RequestMapping(value = "/sell/{identifier}", method = RequestMethod.POST)
+ @RequestMapping(value = "/sell/{companyId}", method = RequestMethod.POST)
public String sell(@ModelAttribute("order") @Valid SellOrder order, BindingResult bindingResult, Model model) {
if (!bindingResult.hasErrors()) {
OrderBookEntry bookEntry = obtainOrderBookForCompany(order.getCompanyId());
@@ -138,14 +138,14 @@ public String sell(@ModelAttribute("order") @Valid SellOrder order, BindingResul
commandBus.dispatch(command);
- return "redirect:/company/" + order.getCompanyId();
+ return "redirect:/company/{companyId}";
}
addPortfolioItemInfoToModel(order.getCompanyId(), model);
return "company/sell";
}
- @RequestMapping(value = "/buy/{identifier}", method = RequestMethod.POST)
+ @RequestMapping(value = "/buy/{companyId}", method = RequestMethod.POST)
public String buy(@ModelAttribute("order") @Valid BuyOrder order, BindingResult bindingResult, Model model) {
if (!bindingResult.hasErrors()) {
@@ -166,7 +166,7 @@ public String buy(@ModelAttribute("order") @Valid BuyOrder order, BindingResult
order.getTradeCount(),
order.getItemPrice());
commandBus.dispatch(command);
- return "redirect:/company/" + order.getCompanyId();
+ return "redirect:/company/{companyId}";
}
addPortfolioMoneyInfoToModel(model);
View
4 web-ui/src/main/webapp/WEB-INF/dispatcher-servlet.xml
@@ -25,11 +25,9 @@
<context:component-scan base-package="org.axonframework.samples.trader.webui"/>
- <context:annotation-config/>
-
<mvc:annotation-driven validator="validator"/>
- <mvc:view-controller path="/index.html" view-name="index"/>
+ <mvc:view-controller path="/index.html"/>
<mvc:resources mapping="/js/**" location="/js/" cache-period="31556926"/>
<mvc:resources mapping="/style/**" location="/style/" cache-period="31556926"/>
View
8 web-ui/src/main/webapp/WEB-INF/jsp/company/buy.jsp
@@ -1,7 +1,7 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
-
+<%@include file="../include.jsp" %>
<%--
~ Copyright (c) 2010-2012. Axon Framework
~
@@ -21,9 +21,9 @@
<content tag="tagline">Enter items to buy and for how much</content>
<content tag="breadcrumb">
<ul class="breadcrumb">
- <li><a href="/">Home</a> <span class="divider">/</span></li>
- <li><a href="/company">Companies</a> <span class="divider">/</span></li>
- <li><a href="/company/<c:out value='${order.companyId}'/>"><c:out value='${order.companyName}'/></a> <span
+ <li><a href="${ctx}/">Home</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/company">Companies</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/company/${order.companyId}"><c:out value='${order.companyName}'/></a> <span
class="divider">/</span></li>
<li class="active">Buy</li>
</ul>
View
4 web-ui/src/main/webapp/WEB-INF/jsp/company/details.jsp
@@ -29,8 +29,8 @@
</content>
<content tag="breadcrumb">
<ul class="breadcrumb">
- <li><a href="/">Home</a> <span class="divider">/</span></li>
- <li><a href="/company">Companies</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/">Home</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/company">Companies</a> <span class="divider">/</span></li>
<li class="active"><c:out value='${company.name}'/></li>
</ul>
</content>
View
3  web-ui/src/main/webapp/WEB-INF/jsp/company/form-include.jsp
@@ -1,6 +1,7 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
+<%@include file="../include.jsp" %>
<%--
~ Copyright (c) 2010-2012. Axon Framework
~
@@ -38,7 +39,7 @@
<td colspan="3">
<input class="btn primary" type="submit" name="submit" value="Place Order"/>
<input class="btn" type="reset" name="reset" value="Reset"/>
- <a href="/company/<c:out value="${order.companyId}"/>" class="btn">Cancel</a>
+ <a href="${ctx}/company/${order.companyId}" class="btn">Cancel</a>
</td>
</tr>
</table>
View
2  web-ui/src/main/webapp/WEB-INF/jsp/company/list.jsp
@@ -32,7 +32,7 @@
<content tag="tagline">Choose the stock to start trading with</content>
<content tag="breadcrumb">
<ul class="breadcrumb">
- <li><a href="/">Home</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/">Home</a> <span class="divider">/</span></li>
<li class="active">Companies</li>
</ul>
</content>
View
8 web-ui/src/main/webapp/WEB-INF/jsp/company/sell.jsp
@@ -1,6 +1,6 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
-
+<%@include file="../include.jsp" %>
<%--
~ Copyright (c) 2010-2012. Axon Framework
~
@@ -21,9 +21,9 @@
<content tag="tagline">Enter items to sell and for how much</content>
<content tag="breadcrumb">
<ul class="breadcrumb">
- <li><a href="/">Home</a> <span class="divider">/</span></li>
- <li><a href="/company">Companies</a> <span class="divider">/</span></li>
- <li><a href="/company/<c:out value='${order.companyId}'/>"><c:out value='${order.companyName}'/></a> <span
+ <li><a href="${ctx}/">Home</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/company">Companies</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/company/${order.companyId}"><c:out value='${order.companyName}'/></a> <span
class="divider">/</span></li>
<li class="active">Sell</li>
</ul>
View
4 web-ui/src/main/webapp/WEB-INF/jsp/data/collection.jsp
@@ -24,8 +24,8 @@
<content tag="tagline">Available collections in this Mongo instance.</content>
<content tag="breadcrumb">
<ul class="breadcrumb">
- <li><a href="/">Home</a> <span class="divider">/</span></li>
- <li><a href="/data/collections">Collections</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/">Home</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/data/collections">Collections</a> <span class="divider">/</span></li>
<li class="active">${collectionName}</li>
</ul>
</content>
View
4 web-ui/src/main/webapp/WEB-INF/jsp/data/collections.jsp
@@ -24,7 +24,7 @@
<content tag="tagline">Available collections in this Mongo instance.</content>
<content tag="breadcrumb">
<ul class="breadcrumb">
- <li><a href="/">Home</a> <span class="divider">/</span></li>
+ <li><a href="${ctx}/">Home</a> <span class="divider">/</span></li>
<li class="active">Collections</li>
</ul>
</content>
@@ -32,7 +32,7 @@
<p>The collections</p>
<ul>
<c:forEach items="${collections}" var="collection">
- <li><a href="/data/collection/${collection}">${collection}</a></li>
+ <li><a href="${ctx}/data/collection/${collection}">${collection}</a></li>
</c:forEach>
</ul>
</body>
View
1  web-ui/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -1,3 +1,4 @@
+<%@include file="include.jsp" %>
<%--
~ Copyright (c) 2010-2012. Axon Framework
~

0 comments on commit 47f634f

Please sign in to comment.
Something went wrong with that request. Please try again.