-
Notifications
You must be signed in to change notification settings - Fork 474
Closed
Milestone
Description
the code like below,
@RequestMapping(value = "/account/{accountName}",method =RequestMethod.GET)
public AccountResource getAccountInfo(@P("u") @PathVariable String accountName) {
AccountResource resource = new AccountResource();
Account account = accountService.getAccountInfo(accountName);
resource.setAccountName(account.getAccountName());
resource.setType(account.getType());
String investorId = account.getInvestor().getId();
log.info("investor id is " + investorId);
Link selfLink = linkTo(methodOn(AccountController.class)
.getAccountInfo(accountName)).withSelfRel();
Link investorLink = linkTo(methodOn(InvestorController.class).getInverstor(investorId)).withRel("investor");
// Link investorLink = new Link(baseUrl + serviceUrl
// + "/investor/" + investorId).withRel("investor");
resource.add(selfLink);
resource.add(investorLink);
if (accountService.getInvestmentProfile(accountName) != null){
Link investmentProfileLink = new Link(baseUrl + serviceUrl
+ "/" + accountName + "/profile").withRel("mandate");
resource.add(investmentProfileLink);
}
return resource;
}
Return Json is
{
"type": "investor",
"accountName": "cc1502762479261",
"_links": {
"self": {
"href": "http://localhost:2222/accounts/account/ccxxxxxxxxx"
},
"investor": {
"href": "http://localhost:2222/accounts/investor/{id}",
"templated": true
},
"mandate": {
"href": "http://localhost:9191/accounts/ccxxxxxxxxxx/profile"
}
}
}
Any ideas?
Metadata
Metadata
Assignees
Labels
No labels