15
15
16
16
import javax .enterprise .context .ApplicationScoped ;
17
17
import javax .inject .Inject ;
18
- import javax .websocket .OnError ;
19
- import javax .websocket .OnMessage ;
20
- import javax .websocket .OnOpen ;
21
- import javax .websocket .Session ;
18
+ import javax .websocket .*;
22
19
import javax .websocket .server .PathParam ;
23
20
import javax .websocket .server .ServerEndpoint ;
24
21
import java .io .IOException ;
@@ -45,16 +42,21 @@ public void onOpen(Session session, @PathParam(TYPE_PATH_PARAM) String type) {
45
42
LOGGER .debug ("Starting session {} for type {}." , session .getId (), type );
46
43
}
47
44
45
+ @ OnMessage
46
+ public void onMessage (Session session , SclValidateRequest request , @ PathParam (TYPE_PATH_PARAM ) String type ) {
47
+ LOGGER .info ("Message from session {} for type {}." , session .getId (), type );
48
+ eventBus .send ("validate-ws" , new SclValidatorEventRequest (
49
+ session , SclFileType .valueOf (type ), request .getSclData ()));
50
+ }
51
+
48
52
@ OnError
49
53
public void onError (Session session , @ PathParam (TYPE_PATH_PARAM ) String type , Throwable throwable ) throws IOException {
50
- LOGGER .info ("Error with session {} for type {}." , session .getId (), type , throwable );
54
+ LOGGER .warn ("Error with session {} for type {}." , session .getId (), type , throwable );
51
55
session .close ();
52
56
}
53
57
54
- @ OnMessage
55
- public void validateSCL (Session session , SclValidateRequest request , @ PathParam (TYPE_PATH_PARAM ) String type ) {
56
- LOGGER .info ("Message from session {} for type {}." , session .getId (), type );
57
- eventBus .send ("validate-ws" , new SclValidatorEventRequest (
58
- session , SclFileType .valueOf (type ), request .getSclData ()));
58
+ @ OnClose
59
+ public void onClose (Session session , @ PathParam (TYPE_PATH_PARAM ) String type ) {
60
+ LOGGER .debug ("Closing session {} for type {}." , session .getId (), type );
59
61
}
60
62
}
0 commit comments