我试图调用一个Web服务,要求我将JSON对象传递给它。虽然我不确定我是否做得对。我的服务执行以下操作:
this.updateAddressDetails = function (address, personId) {
var url = 'http://213.456.123.456:8080/Address?' +
'action=updateAddress' +
'&personId=' + personId +
'&address=' + JSON.stringify(address);
return $http.get(url);
}
但我得到以下错误服务器端(我使用Java Servlets):
解析HTTP请求标头时出错
这让我想到我没有以正确的方式将JSON传递给服务器。有什么提示吗?
答案 0 :(得分:1)
如果你正在使用角度JS,请尝试这样的事情:
class LineCleaner {
private String line;
private char remove;
public LineCleaner(String s, char rem) {
setCleaner(s, rem);
}
public void setCleaner(String s, char rem) {
line = s;
remove = rem
}
public String getCleaned() {
String cleaned = line;
int loc = cleaned.indexOf(remove);
while (/*CONDITION*/) {
// what to do here
}
return cleaned;
}
public String toString() {
return line + " - letter to remove " + remove;
}
}