MessageToClient _createMessageToClient ( MessageFromClient message , T session ) { MessageToClient messageToClient = new MessageToClient ( ) ; messageToClient . setId ( message . getId ( ) ) ; try { Class cls = Class . forName ( message . getDataService ( ) ) ; Object dataService = this . getDataService ( session , cls ) ; logger . debug ( "Process message {}" , message ) ; List < Object > arguments = getArrayList ( ) ; Method method = methodServices . getMethodFromDataService ( cls , message , arguments ) ; injectSession ( method . getParameterTypes ( ) , arguments , session ) ; messageToClient . setResult ( method . invoke ( dataService , arguments . toArray ( ) ) ) ; if ( method . isAnnotationPresent ( JsonMarshaller . class ) ) { messageToClient . setJson ( argumentServices . getJsonResultFromSpecificMarshaller ( method . getAnnotation ( JsonMarshaller . class ) , messageToClient . getResponse ( ) ) ) ; } try { Method nonProxiedMethod = methodServices . getNonProxiedMethod ( cls , method . getName ( ) , method . getParameterTypes ( ) ) ; messageToClient . setDeadline ( cacheManager . processCacheAnnotations ( nonProxiedMethod , message . getParameters ( ) ) ) ; } catch ( NoSuchMethodException ex ) { logger . error ( "Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method . getName ( ) , ex ) ; } logger . debug ( "Method {} proceed messageToClient : {}." , method . getName ( ) , messageToClient ) ; } catch ( InvocationTargetException ex ) { Throwable cause = ex . getCause ( ) ; if ( ConstraintViolationException . class . isInstance ( cause ) ) { messageToClient . setConstraints ( constraintServices . extractViolations ( ( ConstraintViolationException ) cause ) ) ; } else { messageToClient . setFault ( faultServices . buildFault ( cause ) ) ; } } catch ( Throwable ex ) { messageToClient . setFault ( faultServices . buildFault ( ex ) ) ; } return messageToClient ; }
Create a MessageToClient from MessageFromClient for session Only for available test use case