Answer the question
In order to leave comments, you need to log in
How to overeat json in rest controller?
I get an error like localhost:8080/api/v1/cardLimit 400 (Bad Request); when i try to send
public class GameLimit implements Serializable {
private static final long serialVersionUID = 1L;
private LimitType firstLimit;
private LimitType secondLimit;
public LimitType getFirstLimit() {
return firstLimit;
}
public void setFirstLimit(LimitType firstLimit) {
this.firstLimit = firstLimit;
}
public LimitType getSecondLimit() {
return secondLimit;
}
public void setSecondLimit(LimitType secondLimit) {
this.secondLimit = secondLimit;
}
}
public class LimitType implements Serializable{
private static final long serialVersionUID = 1L;
private BigDecimal limit;
private String type;
private String status;
public BigDecimal getLimit() {
return limit;
}
public void setLimit(BigDecimal limit) {
this.limit = limit;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
public class LimitReq extends GameLimit {
private String key;
public String getKey() {
return key;
}
}
@RequestMapping(value = "/GameLimit", method = RequestMethod.POST)
public Response setCardLimit(@RequestBody GameLimitReq request) throws Exception {
return limitService.updateGameLimit(request);
}
changeLimits(firstLimit: IWidgetLimit, secondLimit: IWidgetLimit, key: string): ng.IPromise<any> {
return this.$http.post(this.apiPrefix + '/GameLimit', {
'firstLimit': {
limit: firstLimit.limit,
type: firstLimit.type,
status: firstLimit.status
},
'secondLimit': {
limit: secondLimit.limit,
type: secondLimit.type,
status: secondLimit.status,
},
key: key
}).then(function (response: any) {
return response.data;
}.bind(this));
}
Answer the question
In order to leave comments, you need to log in
Are you using Spring Security?
If so, how do you pass the csrf token?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question