protected String httpDelete ( String request ) throws IOException { String host = getKieRESTUrl ( ) ; URL url = new URL ( host + "/" + request ) ; Activator . println ( "[DELETE] " + url . toString ( ) ) ; HttpURLConnection conn = ( HttpURLConnection ) url . openConnection ( ) ; conn . setRequestMethod ( "DELETE" ) ; conn . setRequestProperty ( "Content" , "application/json" ) ; setHttpCredentials ( conn ) ; String response = new BufferedReader ( new InputStreamReader ( ( conn . getInputStream ( ) ) ) ) . readLine ( ) ; Activator . println ( "[DELETE] response: " + response ) ; if ( conn . getResponseCode ( ) != HttpURLConnection . HTTP_ACCEPTED ) { throw new IOException ( "HTTP DELETE failed : HTTP error code : " + conn . getResponseCode ( ) ) ; } JsonObject jo = JsonObject . readFrom ( response ) ; String status = jo . get ( "status" ) . asString ( ) ; if ( status != null && ! status . isEmpty ( ) ) { if ( ! "APPROVED" . equals ( status ) ) throw new IOException ( "HTTP DELETE failed : Request status code : " + status ) ; } String jobId = jo . get ( "jobId" ) . asString ( ) ; if ( jobId != null && ! jobId . isEmpty ( ) ) return jobId ; return response ; }
Send an HTTP DELETE request to the KIE console .