Java EE 7 Application Developer — Question 42
You need to exchange large binary messages using chunks in a WebSocket application. Identify two ways in which you can receive partial messages. (Choose two.)
Answer options
- A. Define an @OnMessage method with a single MimePart parameter.
- B. Use a ChunkListener interface implementation.
- C. Use a MessageHandler.Partial<ByteBuffer> interface implementation.
- D. Define an @OnMessage method with byte [] as the first parameter and a boolean as the second parameter.
Correct answer: C, D
Explanation
The correct answers are C and D because they specifically facilitate the handling of partial messages in a WebSocket context. Option C allows for processing partial ByteBuffer messages, while option D enables handling messages as byte arrays with an indication of completeness. Options A and B do not provide the necessary functionality for receiving partial messages.