Java 如果我更改搜索条件,是否停止web服务?
我有一个web服务从前端启动。我有日期:从和日期:到搜索条件 这是我的服务:Java 如果我更改搜索条件,是否停止web服务?,java,angular,spring,Java,Angular,Spring,我有一个web服务从前端启动。我有日期:从和日期:到搜索条件 这是我的服务: downloadEmailAttachmentsByNumber(from: any, to: any) { return this.httpClient.get('/shared/Modal/getAttachmentsByNumber? from=' + from + '&to=' + to); } 我的spring web服务: @RequestMapping(value = "/getAtt
downloadEmailAttachmentsByNumber(from: any, to: any) {
return
this.httpClient.get('/shared/Modal/getAttachmentsByNumber?
from=' + from + '&to=' + to);
}
我的spring web服务:
@RequestMapping(value = "/getAttachmentsByNumber", method = RequestMethod.GET)
public ResponseEntity<List<Integer>> getAttachmentsByNumber(
@RequestParam(value = "from", required = false) Long from,
@RequestParam(value = "to", required = false) Long to) {
Timestamp fromDate = null;
Timestamp toDate = null;
if (from != null) {
fromDate = new Timestamp(from);
toDate = new Timestamp(to);
}
List<Integer> attachmentsList= this.downloadAttachmentService.getAttachmentsByNumber(fromDate,
toDate);
return new ResponseEntity<>(attachmentsList, HttpStatus.OK);
}
@RequestMapping(value=“/getAttachmentsByNumber”,method=RequestMethod.GET)
公共响应获取附件编号(
@RequestParam(value=“from”,required=false)的长度从,
@RequestParam(value=“to”,required=false)Long to){
时间戳fromDate=null;
时间戳toDate=null;
if(from!=null){
fromDate=新的时间戳(从);
toDate=新的时间戳(to);
}
List attachmentsList=this.downloadAttachmentService.getAttachmentsByNumber(fromDate,
托德);
返回新的响应属性(附件列表,HttpStatus.OK);
}
我的问题当我将搜索条件从和更改为时,web服务仍处于使用旧搜索条件和新搜索条件的执行模式:
这幅图显示:
如何解决这个问题?感谢您的帮助。创建单独的服务来调用您的API在搜索和onChange事件时订阅它只需在生命周期挂钩中调用unsubscribe()方法,它将停止您的服务从API获取数据