HTTP错误400错误请求

时间:2015-12-20 15:39:53

标签: java spring-mvc

我有一个应用程序(使用注释的Spring 4 MVC + Hibernate 4 + MySQL + Maven集成示例),使用基于注释的配置将Spring与Hibernate集成。

这是我的控制器:

@Controller
public class RestController {


    @RequestMapping(value = { "/restCallBack" }, method = RequestMethod.GET)
    @ResponseBody
    public String performCallBack(@RequestBody RestCallBack restCallBack) {
        Preconditions.checkNotNull( restCallBack );

    return "computerList";

    }

但是当我把它放在浏览器上时,我得到了400:

http://localhost:8080/myApp/restCallBack?devideId=devideId&time=time&duplicate=duplicate&snr=snr&station=station&data=data&avgSignal=avgSignal&lat=lat&lng=lng&rssi=rssi&seqNumber=seqNumber

这里是RestCallBack类

public class RestCallCallBack {

    private String devideId;

    private String time;

    private String duplicate;

    private String snr;

    private String station;

    private String data;

    private String avgSignal;

    private String lat;

    private String lng;

    private String rssi;

    private String seqNumber;

    public String getDevideId() {
        return devideId;
    }

    public void setDevideId(String devideId) {
        this.devideId = devideId;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getDuplicate() {
        return duplicate;
    }

    public void setDuplicate(String duplicate) {
        this.duplicate = duplicate;
    }

    public String getSnr() {
        return snr;
    }

    public void setSnr(String snr) {
        this.snr = snr;
    }

    public String getStation() {
        return station;
    }

    public void setStation(String station) {
        this.station = station;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getAvgSignal() {
        return avgSignal;
    }

    public void setAvgSignal(String avgSignal) {
        this.avgSignal = avgSignal;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getLng() {
        return lng;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public String getRssi() {
        return rssi;
    }

    public void setRssi(String rssi) {
        this.rssi = rssi;
    }

    public String getSeqNumber() {
        return seqNumber;
    }

    public void setSeqNumber(String seqNumber) {
        this.seqNumber = seqNumber;
    }


}

0 个答案:

没有答案