Skip to content

Websocket updates #1055

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

Merged
merged 5 commits into from
Apr 22, 2025
Merged

Websocket updates #1055

merged 5 commits into from
Apr 22, 2025

Conversation

malmgrens4
Copy link
Collaborator

@malmgrens4 malmgrens4 commented Apr 15, 2025

See codice/ddf#6894
The move to pax web 8.0.24 updated websocket use and registration. Unlike other servlets there is no direct whiteboard registration for websockets. While there are a couple ways to register a websocket between the java servlet specification, jetty, and pax web this approach uses the Java Servlet annotation @WebServlet which works with all three.
Pax web requires a more complicated setup for websockets through other approaches but by using this annotation and registering the Websocket bundles as WABs it correctly configures the Servlet registration/ Websocket upgrade.

SecureWebsocketServlet has been changed to a websocketCreator for use with the new WABs that must be deployed for websocket integration.


ServletContextHandler notesServletContextHandler =
new ServletContextHandler(ServletContextHandler.SESSIONS);
servletContextHandler.setContextPath("/search/catalog/notes");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Should this be notesServletContextHandler.setContextPath("/search/catalog/notes"); instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holdover from another attempted solution. Will be deleting


ServletContextHandler servletContextHandler =
new ServletContextHandler(ServletContextHandler.SESSIONS);
servletContextHandler.setContextPath("/search/catalog/ws");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I'm wondering if these configurable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probably should be constants at a minimum if not configurable

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

<parent>
<artifactId>backend</artifactId>
<groupId>org.codice.ddf.search</groupId>
<version>5.2.17-SNAPSHOT</version>
Copy link
Collaborator

@alexabird alexabird Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏️ rebase needed - this version will need to be updated to match master

@@ -45,14 +45,6 @@ Services (HTTP/WS) that catalog-ui-search provides for the UI
</service-properties>
</service>

<service ref="socketServlet" interface="javax.servlet.Servlet">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer register a standard servlet for websockets. The specifications pax web adheres to are for osgi's whiteboard pattern - which is for http. As a result websockets aren't directly supported through whiteboard servlet registration.

<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Web-ContextPath>/search/catalog/ws</Web-ContextPath>
Copy link
Collaborator Author

@malmgrens4 malmgrens4 Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Register as a WAB. Pax web listens for websockets created in WABs (but not the old websocket annotations)

@alexabird
Copy link
Collaborator

build now

@cxddfuibot
Copy link
Collaborator

Internal build has been started, your results will be available at build completion.

@cxddfuibot
Copy link
Collaborator

Build SUCCESS See the job results in legacy Jenkins UI or in Blue Ocean UI.

@malmgrens4 malmgrens4 merged commit 818c8fa into codice:master Apr 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants