Skip to content
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

Add WebSockets OnMessage Parameter Validation Diagnostic #277

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

TheAvi123
Copy link
Contributor

Resolves #244

@TheAvi123 TheAvi123 marked this pull request as draft March 24, 2022 05:10
@TheAvi123 TheAvi123 changed the title Add Relevant Constants WebSockets OnMessage Parameter Validation Diagnostic Mar 24, 2022
@TheAvi123 TheAvi123 changed the title WebSockets OnMessage Parameter Validation Diagnostic Add WebSockets OnMessage Parameter Validation Diagnostic Mar 24, 2022
@TheAvi123 TheAvi123 marked this pull request as ready for review April 12, 2022 05:58
Comment on lines +86 to +94
/* For OnMessage annotation */
public static final Set<String> ON_MESSAGE_PARAM_OPT_TYPES = new HashSet<>(Arrays.asList("jakarta.websocket.Session"));
public static final Set<String> RAW_ON_MESSAGE_PARAM_OPT_TYPES = new HashSet<>(Arrays.asList("Session"));
/* For OnMessage (Text) annotation */
public static final Set<String> ON_MESSAGE_TEXT_TYPES = new HashSet<>(Arrays.asList("java.lang.String", "java.io.Reader", "String", "Reader"));
/* For OnMessage (Text) annotation */
public static final Set<String> ON_MESSAGE_BINARY_TYPES = new HashSet<>(Arrays.asList("java.nio.ByteBuffer", "java.io.InputStream", "ByteBuffer", "InputStream"));
/* For OnMessage (Text) annotation */
public static final Set<String> ON_MESSAGE_PONG_TYPES = new HashSet<>(Arrays.asList("jakarta.websocket.PongMessage", "PongMessage"));
Copy link
Contributor

Choose a reason for hiding this comment

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

If you pull the latest from main, I suspect that you'll be able to use the already defined strings for these types.

@@ -1,5 +1,5 @@
package io.openliberty.sample.jakarta.websocket;

Copy link
Contributor

Choose a reason for hiding this comment

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

seems like you accidentally added whitespace here.

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.

WebSocket: Validate for parameters onMessage message handler
2 participants