private void executePutOperation ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ClassNotFoundException { if ( request . getContentLength ( ) > 0 ) { ObjectInputStream input = new ObjectInputStream ( new BufferedInputStream ( request . getInputStream ( ) ) ) ; CommandPayload payload = ( CommandPayload ) input . readObject ( ) ; Command operation = payload . getCommand ( ) ; Manager manager = ( Manager ) request . getAttribute ( ARQUILLIAN_MANAGER_ATTRIBUTE ) ; // execute remote Event try { manager . fire ( new ActivateManager ( manager ) ) ; manager . inject ( operation ) ; operation . perform ( ) ; manager . fire ( new PassivateManager ( manager ) ) ; } catch ( Throwable e ) { payload . setThrowable ( e ) ; } response . setStatus ( HttpServletResponse . SC_OK ) ; ObjectOutputStream output = new ObjectOutputStream ( response . getOutputStream ( ) ) ; output . writeObject ( payload ) ; output . flush ( ) ; output . close ( ) ; } else { response . setStatus ( HttpServletResponse . SC_NO_CONTENT ) ; } }
Client - to - Container event propagation