[Admin tools | Trunk]: BrowserCacheController.java: Commented catch of exceptions to print error stacktraces | [Bug fix] Response is HTML, so added String.class instead of Object.class.
This commit is contained in:
parent
ee0eb49e24
commit
09d1088a8b
|
@ -3,7 +3,6 @@ package eu.dnetlib.uoaadmintools.controllers;
|
||||||
import eu.dnetlib.uoaadmintools.configuration.properties.BrowserCacheConfig;
|
import eu.dnetlib.uoaadmintools.configuration.properties.BrowserCacheConfig;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
@ -27,15 +26,18 @@ public class BrowserCacheController {
|
||||||
"@AuthorizationService.curator('community'), @AuthorizationService.manager('community', #pid))")
|
"@AuthorizationService.curator('community'), @AuthorizationService.manager('community', #pid))")
|
||||||
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
|
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
|
||||||
public boolean purge(@PathVariable(value = "pid") String pid) {
|
public boolean purge(@PathVariable(value = "pid") String pid) {
|
||||||
try {
|
// try {
|
||||||
ResponseEntity<Object> responseEntity = restTemplate.getForEntity(config.getUrl().replace("{community}", pid), Object.class);
|
restTemplate.getForEntity(config.getUrl().replace("{community}", pid), String.class);
|
||||||
} catch(HttpClientErrorException httpClientErrorException) {
|
// } catch(HttpClientErrorException httpClientErrorException) {
|
||||||
log.debug("Purge browser cache: HttpClientErrorException for "+pid + " - code: " + httpClientErrorException.getStatusCode());
|
// log.debug("Purge browser cache: HttpClientErrorException for "+pid + " - code: " + httpClientErrorException.getStatusCode());
|
||||||
} catch(ResourceAccessException resourceAccessException) {
|
// return false;
|
||||||
log.debug("Purge browser cache: ResourceAccessException for "+pid);
|
// } catch(ResourceAccessException resourceAccessException) {
|
||||||
} catch(Exception exception) {
|
// log.debug("Purge browser cache: ResourceAccessException for "+pid);
|
||||||
log.debug("Purge browser cache: " + exception.getClass() + " for "+pid);
|
// return false;
|
||||||
}
|
// } catch(Exception exception) {
|
||||||
|
// log.debug("Purge browser cache: " + exception.getClass() + " for "+pid);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue