Skip to content

Commit

Permalink
Merge branch 'develop' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
julg committed Apr 30, 2024
2 parents 06e3c60 + d990d83 commit 2e699c6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/main/java/fr/abes/theses/export/filters/MaintenanceFilter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package fr.abes.theses.export.filters;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Component
@Order(1)
public class MaintenanceFilter implements Filter {

@Value("${maintenance}")
private boolean isMaintenance;

@Value("${maintenance.message}")
private String maintenanceMsg;

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;

if (isMaintenance) {
httpResponse.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
httpResponse.getWriter().write(maintenanceMsg);
} else {
chain.doFilter(request, response);
}
}
}
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ path.xsls=

logging.level.fr.abes=
racine=

maintenance.export=false
maintenance.export.message=Service en maintenance. Veuillez reessayer plus tard.

0 comments on commit 2e699c6

Please sign in to comment.