我在web服務新的,目前能夠通過調用運行我的查詢https://localhost/application/service/v1.0/contacts/account= {帳戶ID} 我想讓我的URL看起來像https://localhost/application/service/v1.0/contacts?account= {帳戶ID}參數傳遞
可我知道如何做到這一點不使用QueryParam?我在Spring MVC中
@Controller
public class ContactListResponseController extends BaseWebServiceController
{
public static final String PATH = "/v" + VERSION + "/contacts/account={accountId}";
@Autowired
private ContactService contactService;
@RequestMapping(value = PATH, method = RequestMethod.GET)
@ResponseBody
public ContactListResponseBean doGetMyAssignedAccounts (@PathVariable String accountId,
HttpServletRequest request,
HttpSession session,
HttpServletResponse response,
@ModelAttribute(User.USER_REQUEST_VAR) User user)
throws Exception
{
List<ContactSummaryWebServiceBean> contactList = contactService.getContactsListForCallPointWebService(accountId);
ContactListResponseBean result = new ContactListResponseBean(contactList);
return result;
}
}
可否請你調試這個控制器檢查,如果'accountId'是建立與2465543400 ?別忘了我已經在兩個地方更改了你的代碼。 – Blank
它的工作。一些問題是與ID。非常感謝 – ronypatil