Java 使用AngularJS通过rest调用Web服务时,客户端发送的请求在语法上不正确
我有WebService,它正在检查数据库中是否已经存在电子邮件Java 使用AngularJS通过rest调用Web服务时,客户端发送的请求在语法上不正确,java,spring,web-services,angularjs,Java,Spring,Web Services,Angularjs,我有WebService,它正在检查数据库中是否已经存在电子邮件 @RequestMapping(value = "/checkPersonEmail/{jClientSessionId}/{jClientSessionId}/{email}", method = RequestMethod.GET) public boolean checkName(@PathVariable String jUserSessionId, @PathVariable String jClient
@RequestMapping(value = "/checkPersonEmail/{jClientSessionId}/{jClientSessionId}/{email}", method = RequestMethod.GET)
public boolean checkName(@PathVariable String jUserSessionId,
@PathVariable String jClientSessionId, @PathVariable String email)
throws Exception {
String decryptedClientKey = EncryptContetns
.getDecryptedvalue(jClientSessionId);
List<String> emailIds = dimPersonManager
.getEmailIdsByClientKey(Long.valueOf(decryptedClientKey));
List<String> emailIdList = new ArrayList<String>();
for (String ids : emailIds) {
emailIdList.add(ids.toLowerCase());
}
if (emailIdList != null && !emailIdList.isEmpty()) {
if (emailIdList.contains(email.toLowerCase())) {
return false;
} else {
return true;
}
} else {
return true;
}
}
无论何时调用此检查电子邮件,它都是一个HTTP错误请求(400) 如果您的控制器没有被注释为
@RestController,可能是因为在@RequestMapping({jClientSessionId}/{jClientSessionId})中有两个jClientSessionId
并且没有jUserSessionId
,
$scope.checkEmail = function() {
if (!appClient.isUndefinedOrNull($scope.person.email)) {
alert( $scope.person.email);
$scope.spinnerClass = "icon-2x icon-spinner icon-spin";
var serverConnect = serverUrl + 'checkPersonEmail' + '/' + jUserSessionId + '/' + jClientSessionId + '/'+ $scope.person.email;
$http.get(serverConnect).success(function(data, status) {
// alert(JSON.stringify(data));
if (data == "true") {
$scope.spinnerClass = "icon-hide";
$scope.msgClass = "text-success icon-ok";
$scope.message = "Available";
} else {
$scope.spinnerClass = "icon-hide";
$scope.msgClass = "text-error icon-remove";
$scope.message = "Not Available";
}
}).error(function(data, status) {
alert("Failure");
});
}
}