andreybavt commited on
Commit
d356c9c
·
1 Parent(s): 15c3ead
Dockerfile CHANGED
@@ -13,4 +13,4 @@ COPY settings.gradle.kts .
13
 
14
  RUN ./gradlew clean build bootJar -x test
15
 
16
- ENTRYPOINT ["java","-jar","build/libs/learn-spring-websockets-0.0.1-SNAPSHOT.jar", "--trace"]
 
13
 
14
  RUN ./gradlew clean build bootJar -x test
15
 
16
+ ENTRYPOINT ["java","-jar","build/libs/learn-spring-websockets-0.0.1-SNAPSHOT.jar"]
src/main/java/ai/giskard/learnspringwebsockets/LearnSpringWebsocketsApplication.java CHANGED
@@ -1,7 +1,16 @@
1
  package ai.giskard.learnspringwebsockets;
2
 
 
 
 
 
3
  import org.springframework.boot.SpringApplication;
4
  import org.springframework.boot.autoconfigure.SpringBootApplication;
 
 
 
 
 
5
 
6
  @SpringBootApplication
7
  public class LearnSpringWebsocketsApplication {
@@ -10,4 +19,22 @@ public class LearnSpringWebsocketsApplication {
10
  SpringApplication.run(LearnSpringWebsocketsApplication.class, args);
11
  }
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
 
1
  package ai.giskard.learnspringwebsockets;
2
 
3
+ import jakarta.servlet.FilterChain;
4
+ import jakarta.servlet.ServletException;
5
+ import jakarta.servlet.http.HttpServletRequest;
6
+ import jakarta.servlet.http.HttpServletResponse;
7
  import org.springframework.boot.SpringApplication;
8
  import org.springframework.boot.autoconfigure.SpringBootApplication;
9
+ import org.springframework.stereotype.Component;
10
+ import org.springframework.web.filter.OncePerRequestFilter;
11
+
12
+ import java.io.IOException;
13
+ import java.util.Enumeration;
14
 
15
  @SpringBootApplication
16
  public class LearnSpringWebsocketsApplication {
 
19
  SpringApplication.run(LearnSpringWebsocketsApplication.class, args);
20
  }
21
 
22
+
23
+ @Component
24
+ class RequestWrapperFilter extends OncePerRequestFilter {
25
+ @Override
26
+ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
27
+ throws ServletException, IOException {
28
+ Enumeration<String> headerNames = request.getHeaderNames();
29
+ System.out.println("!!!! HEADERS");
30
+ if (headerNames != null) {
31
+ while (headerNames.hasMoreElements()) {
32
+ System.out.println("Header: " + request.getHeader(headerNames.nextElement()));
33
+ }
34
+ }
35
+ filterChain.doFilter(request, response);
36
+ }
37
+ }
38
+
39
+
40
  }