private < T extends DavidBoxResponse > T sendAndParse ( String urlGet , Class < T > responseTargetClass ) throws TheDavidBoxClientException { logger . debug ( "urlGet: " + urlGet ) ; //Notify the listener about the request notifyRequest ( urlGet ) ; // Call the davidbox service to get the xml response String xmlResponse = "" ; try { xmlResponse = getRemoteHttpService ( ) . sendGetRequest ( urlGet ) ; } catch ( TheDavidBoxClientException e1 ) { throw new TheDavidBoxClientException ( e1 , urlGet , xmlResponse ) ; } //Notify the listener about the response notifyResponse ( xmlResponse ) ; // Parse the response into a business object T responseObject = null ; try { responseObject = getDavidBoxPaser ( ) . parse ( responseTargetClass , xmlResponse ) ; } catch ( TheDavidBoxClientException e2 ) { throw new TheDavidBoxClientException ( e2 , urlGet , xmlResponse ) ; } return responseObject ; }
It sends the url get to the service and parse the response in the desired response target class .