I have application en Back Java Spring Boot and in front Angular.
In front i am using a REST api to delete a file on my server but I have a 404 error even though the service has been consume and finished correctly.
I pence that the problem comes from the waiting time of my response.
I have a proxy that I do not find great.
So my question is there any way to increase the wait time of answer Angular Rxjs Observable?
// services
deleteFileByName(fileName: String){
let url = this.host + '/files/' + fileName;
console.log(url);
console.log(this.http.delete(url, {headers: this.headers}));
/* Observable
return this.http.delete(url, {headers: this.headers}); */
return this.http.delete(url, {headers: this.headers}).toPromise();
}
// component
/*Delete */
/* Observable
public onDeleteFile(filename) {
let c = confirm('Are you want permanently delete ' + filename + ' ?');
if (!c) {
return;
}
this.uploadService.deleteFileByName(filename).pipe(timeout(90000)).subscribe(data => {
console.log('Delete done');
}, error => {
alert(error);
});
}*/
onDeleteFile(filename) {
this.uploadService.deleteFileByName(filename).then(() => {
alert("ok");
}).catch((error) => {
console.log(error);
})
}
// security
http.authorizeRequests().antMatchers("/appUsers/**","/appRole/**", "/allUser/**", "/appParam/**","/files/**","/upload/**").hasAuthority("ADMIN");
// Controller
@DeleteMapping(value="/files/{filename}")
public void delete(@PathVariable(name = "filename")String filename){
logger.info("Delete file Start " + filename);
storageService.deleteByFilename(filename);
logger.info("Delete file " + filename + " over ");
}
//console Java
2021-01-25 10:51:22.682 INFO 19640 --- [io-8082-exec-10]
c.a.toDoList.controller.FilesController : Delete file Start image
(3).png 2021-01-25 10:51:22.686 INFO 19640 --- [io-8082-exec-10]
c.a.toDoList.controller.FilesController : Delete file image (3).png
over
// Console Brwoser
enter image description here
question from:
https://stackoverflow.com/questions/65830171/angular-how-to-increase-the-waiting-time-for-an-answer-of-api-rest-observable-rx 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…