check if response is already committed on error

This commit is contained in:
lucio.lelii 2021-03-01 16:21:52 +01:00
parent 47f09fe3a5
commit bc1f02cdb5
3 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Common Smartgears
## [v3.0.2] - 2020-03-01
- check if response is already committed on error
## [v3.0.1] - 2020-11-18
- new Uma Token integration

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>
<version>3.0.1</version>
<version>3.0.2-SNAPSHOT</version>
<name>SmartGears</name>
<dependencyManagement>

View File

@ -98,7 +98,7 @@ public class RequestManager implements Filter {
// dispatch to other filters for this servlet
chain.doFilter(request, response);
}catch(ServletException t){
log.error("error in doFilter",t.getRootCause());
log.error("error in doFilter",t);
handleError(httprequest,httpresponse,t.getRootCause());
}
@ -260,7 +260,8 @@ public class RequestManager implements Filter {
RequestException.class.cast(t).error():
application_error;
response.resetBuffer();
if (!response.isCommitted())
response.resetBuffer();
if (error == request_not_authorized_error){
response.setHeader("WWW-Authenticate", "Basic realm=\"Smartgears\"");
log.info("setting WWW-Authenticate to response header");