1 package com.atlassian.johnson.spring.lifecycle;
2
3 import com.atlassian.johnson.spring.web.filter.BypassableDelegatingFilterProxy;
4
5 import javax.annotation.Nonnull;
6 import javax.servlet.FilterChain;
7 import javax.servlet.ServletException;
8 import javax.servlet.ServletRequest;
9 import javax.servlet.ServletResponse;
10 import java.io.IOException;
11
12
13
14
15
16
17
18 public class LifecycleDelegatingFilterProxy extends BypassableDelegatingFilterProxy {
19
20 private volatile boolean starting = true;
21
22 @Override
23 public void doFilter(@Nonnull ServletRequest request, @Nonnull ServletResponse response,
24 @Nonnull FilterChain filterChain) throws ServletException, IOException {
25 if (starting) {
26 if (LifecycleUtils.isStarting(getServletContext())) {
27
28 filterChain.doFilter(request, response);
29
30 return;
31 } else {
32
33
34 starting = false;
35 }
36 }
37
38 super.doFilter(request, response, filterChain);
39 }
40 }