我想拨打一个休息的网络服务电话:
@RestController
@RequestMapping("stock")
public class StockController {
@Autowired
private StockService stockService;
@GetMapping(value = "/TOM", produces = "application/json")
public JsonModel getByLocAndItm(@RequestParam(required=false) String LOC, @RequestParam(required=false) String ITM) {
JsonModel jsonModel = new JsonModel();
List<com.java.oxalys.beans.Stock> stock = stockService.getByLocAndItm(LOC.split("|"), null);
jsonModel.setDatas(stock);
return jsonModel;
}
}
服务:
@Service
public class StockServiceImpl implements StockService {
@Autowired
private StockDao stockDao;
@Override
public List<com.java.oxalys.beans.Stock> getByLocAndItm(String[] locs, String[] itms) {
return stockDao.getByLocAndItm(locs, itms);
}
}
DAO:
@Repository
public class StockDaoImpl implements StockDao {
@Override
public List<Stock> getByLocAndItm(String[] locs, String[] itms) {
List<Stock> ret = new ArrayList<Stock>();
String where = "";
String where_locs = "", sep_locs = "";
for(String loc : locs) {
where_locs += sep_locs + " s.LOC_0 = '" + loc + "'";
sep_locs = " or ";
}
where_locs = "(" + where_locs + ")";
where = where_locs;
Stock tmp = new Stock();
tmp.setLoc("eto");
tmp.setItmoxa(where);
ret.add(tmp);
return ret;
}
}
在运行邮递员时:localhost:8080/Oxalys_WS/stock/TOM?LOC=BOQSCM171L
,然后出现错误The resource identified by this request is able to generate responses only with features incompatible with the "accept" directive present in the request header
那怎么了?