Java Code Examples for javax.websocket.Session#getMessageHandlers()

The following examples show how to use javax.websocket.Session#getMessageHandlers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PojoEndpointBase.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public final void onClose(Session session, CloseReason closeReason) {

    if (methodMapping.getOnClose() != null) {
        try {
            methodMapping.getOnClose().invoke(pojo,
                    methodMapping.getOnCloseArgs(pathParameters, session, closeReason));
        } catch (Throwable t) {
            log.error(sm.getString("pojoEndpointBase.onCloseFail",
                    pojo.getClass().getName()), t);
            handleOnOpenOrCloseError(session, t);
        }
    }

    // Trigger the destroy method for any associated decoders
    Set<MessageHandler> messageHandlers = session.getMessageHandlers();
    for (MessageHandler messageHandler : messageHandlers) {
        if (messageHandler instanceof PojoMessageHandlerWholeBase<?>) {
            ((PojoMessageHandlerWholeBase<?>) messageHandler).onClose();
        }
    }
}
 
Example 2
Source File: PojoEndpointBase.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public final void onClose(Session session, CloseReason closeReason) {

    if (methodMapping.getOnClose() != null) {
        try {
            methodMapping.getOnClose().invoke(pojo,
                    methodMapping.getOnCloseArgs(pathParameters, session, closeReason));
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            log.error(sm.getString("pojoEndpointBase.onCloseFail",
                    pojo.getClass().getName()), t);
        }
    }

    // Trigger the destroy method for any associated decoders
    Set<MessageHandler> messageHandlers = session.getMessageHandlers();
    for (MessageHandler messageHandler : messageHandlers) {
        if (messageHandler instanceof PojoMessageHandlerWholeBase<?>) {
            ((PojoMessageHandlerWholeBase<?>) messageHandler).onClose();
        }
    }
}
 
Example 3
Source File: PojoEndpointBase.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public final void onClose(Session session, CloseReason closeReason) {

    if (methodMapping.getOnClose() != null) {
        try {
            methodMapping.getOnClose().invoke(pojo,
                    methodMapping.getOnCloseArgs(pathParameters, session, closeReason));
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            log.error(sm.getString("pojoEndpointBase.onCloseFail",
                    pojo.getClass().getName()), t);
        }
    }

    // Trigger the destroy method for any associated decoders
    Set<MessageHandler> messageHandlers = session.getMessageHandlers();
    for (MessageHandler messageHandler : messageHandlers) {
        if (messageHandler instanceof PojoMessageHandlerWholeBase<?>) {
            ((PojoMessageHandlerWholeBase<?>) messageHandler).onClose();
        }
    }
}