-
Notifications
You must be signed in to change notification settings - Fork 0
Backport of steve-community/steve #1820 #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||
| package de.rwth.idsg.steve; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import de.rwth.idsg.steve.config.WebConfig; | ||||||||||||||||||||||||||||||||||||
| import de.rwth.idsg.steve.utils.LogFileRetriever; | ||||||||||||||||||||||||||||||||||||
| import de.rwth.idsg.steve.utils.SteveConfigurationReader; | ||||||||||||||||||||||||||||||||||||
| import lombok.extern.slf4j.Slf4j; | ||||||||||||||||||||||||||||||||||||
|
|
@@ -36,11 +37,13 @@ | |||||||||||||||||||||||||||||||||||
| public class Application { | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| private final SteveConfiguration config; | ||||||||||||||||||||||||||||||||||||
| private final LogFileRetriever logFileRetriever; | ||||||||||||||||||||||||||||||||||||
| private final JettyServer server; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| public Application(SteveConfiguration config, LogFileRetriever logFileRetriever) { | ||||||||||||||||||||||||||||||||||||
| this.config = config; | ||||||||||||||||||||||||||||||||||||
| this.server = new JettyServer(config, logFileRetriever); | ||||||||||||||||||||||||||||||||||||
| this.logFileRetriever = logFileRetriever; | ||||||||||||||||||||||||||||||||||||
| this.server = new JettyServer(config); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| public static void main(String[] args) throws Exception { | ||||||||||||||||||||||||||||||||||||
|
|
@@ -82,6 +85,7 @@ public static void main(String[] args) throws Exception { | |||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| public void start() throws Exception { | ||||||||||||||||||||||||||||||||||||
| WebConfig.initialize(config, logFileRetriever); | ||||||||||||||||||||||||||||||||||||
| server.start(); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
87
to
90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure cleanup if start() fails If - public void start() throws Exception {
- WebConfig.initialize(config, logFileRetriever);
- server.start();
- }
+ public void start() throws Exception {
+ try {
+ WebConfig.initialize(config, logFileRetriever);
+ server.start();
+ } catch (Exception e) {
+ try {
+ WebConfig.clear();
+ } catch (Exception suppressed) {
+ e.addSuppressed(suppressed);
+ }
+ throw e;
+ }
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -91,5 +95,6 @@ public void join() throws Exception { | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| public void stop() throws Exception { | ||||||||||||||||||||||||||||||||||||
| server.stop(); | ||||||||||||||||||||||||||||||||||||
| WebConfig.clear(); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
96
to
99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always clear WebConfig even if server.stop() throws Run - public void stop() throws Exception {
- server.stop();
- WebConfig.clear();
- }
+ public void stop() throws Exception {
+ try {
+ server.stop();
+ } finally {
+ WebConfig.clear();
+ }
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Jetty WS dependency: verify correct artifact and scope.
jetty-websocket-jetty-apimay be insufficient at runtime;JettyRequestUpgradeStrategytypically needs Jetty WebSocket SERVER classes. Consider addingjetty-websocket-jetty-server(or mark API asprovidedif the server brings it).Proposed addition if needed:
<dependency> <groupId>org.eclipse.jetty.websocket</groupId> <artifactId>jetty-websocket-jetty-api</artifactId> </dependency> + <dependency> + <groupId>org.eclipse.jetty.websocket</groupId> + <artifactId>jetty-websocket-jetty-server</artifactId> + </dependency>Web check to confirm exact artifacts for Spring 6.2 + Jetty 12:
🌐 Web query:
💡 Result:
Short answer — include Jetty's WebSocket API + server implementation for Jetty 12 (and the Jakarta WebSocket implementation if you rely on the standard jakarta.websocket API). In practice add these runtime artifacts:
Sources: Spring 6.2 API (JettyRequestUpgradeStrategy for Jetty 12 EE10). [3] Jetty 12 WebSocket docs. [1][2]
References
[1] Jetty WebSocket docs (Jetty 12).
[2] Jetty EE10 Jakarta WebSocket implementation docs.
[3] Spring Framework 6.2 Javadoc — JettyRequestUpgradeStrategy.
Add Jetty server WebSocket implementation (runtime)
File: steve-ocpp-transport-websocket/pom.xml
jetty-websocket-jetty-api is only the API; add the server implementation at runtime or mark the API as provided if your runtime supplies it. If using Jakarta WebSocket endpoints, also include jakarta.websocket:jakarta.websocket-api and org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server.
<dependency> <groupId>org.eclipse.jetty.websocket</groupId> <artifactId>jetty-websocket-jetty-api</artifactId> </dependency> + <dependency> + <groupId>org.eclipse.jetty.websocket</groupId> + <artifactId>jetty-websocket-jetty-server</artifactId> + </dependency>📝 Committable suggestion
🤖 Prompt for AI Agents