public static void undeploy(String url, String warName, String token) throws Exception {
    HttpClient client = httpClient();
    
    HttpPost del = new HttpPost(url + "/system/undeploy");
    addAuthHeader(token, del);
    del.addHeader("Content-Type", MediaType.APPLICATION_JSON);
    
    UndeployRequest req = new UndeployRequest();
    req.setWarName(warName);
    
    del.setEntity(new StringEntity(new Gson().toJson(req), "UTF-8"));
    
    HttpResponse resp = client.execute(del);
    
    if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
      String respStr = EntityUtils.toString(resp.getEntity());
      if(!respStr.equals("ok")) {
        throw new Exception("Failed to undeploy "+warName);
      } else {
        System.out.println("Undeployment of "+warName+" successful");
      }
    } else {
      System.err.println("Failed to undeploy "+warName);
      System.err.println(resp.getStatusLine().getStatusCode()+": "+EntityUtils.toString(resp.getEntity()));
    }
  }
public static void undeploy ( String url , String warName , String token ) throws Exception { HttpClient client = httpClient ( ) ; HttpPost del = new HttpPost ( url + "/system/undeploy" ) ; addAuthHeader ( token , del ) ; del . addHeader ( "Content-Type" , MediaType . APPLICATION_JSON ) ; UndeployRequest req = new UndeployRequest ( ) ; req . setWarName ( warName ) ; del . setEntity ( new StringEntity ( new Gson ( ) . toJson ( req ) , "UTF-8" ) ) ; HttpResponse resp = client . execute ( del ) ; if ( resp . getStatusLine ( ) . getStatusCode ( ) == HttpStatus . SC_OK ) { String respStr = EntityUtils . toString ( resp . getEntity ( ) ) ; if ( ! respStr . equals ( "ok" ) ) { throw new Exception ( "Failed to undeploy " + warName ) ; } else { System . out . println ( "Undeployment of " + warName + " successful" ) ; } } else { System . err . println ( "Failed to undeploy " + warName ) ; System . err . println ( resp . getStatusLine ( ) . getStatusCode ( ) + ": " + EntityUtils . toString ( resp . getEntity ( ) ) ) ; } }
Sends the undeploy command to a Cadmium-Deployer war.

@param url The uri to a Cadmium-Deployer war.
@param warName The war to undeploy.
@param token The Github API token used for authentication.
@throws Exception