private void executeGetOperation ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ClassNotFoundException { if ( request . getContentLength ( ) > 0 ) { response . setStatus ( HttpServletResponse . SC_NO_CONTENT ) ; ObjectInputStream input = new ObjectInputStream ( new BufferedInputStream ( request . getInputStream ( ) ) ) ; CommandPayload paylod = ( CommandPayload ) input . readObject ( ) ; events . put ( currentCall , paylod ) ; } else { if ( events . containsKey ( currentCall ) && ! events . get ( currentCall ) . isExecuted ( ) ) { response . setStatus ( HttpServletResponse . SC_OK ) ; ObjectOutputStream output = new ObjectOutputStream ( response . getOutputStream ( ) ) ; output . writeObject ( events . remove ( currentCall ) ) ; output . flush ( ) ; output . close ( ) ; } else { response . setStatus ( HttpServletResponse . SC_NO_CONTENT ) ; } } }
Container - to - Client command execution