ArcGIS Server清除緩存(Java後臺清理緩存方法)

public String clearCache(){
  String url="http://localhost:8399/arcgis/rest/admin/login?username=arcgis&password=arcgis" +
    "&redirect=http://localhost:8399/arcgis/rest/admin/cache/clear";
  //構造HttpClient的實例
  HttpClient httpClient = new HttpClient();
  //創建GET方法的實例
  GetMethod getMethod = new GetMethod(url);  
  int statusCode;
  try {
   statusCode = httpClient.executeMethod(getMethod);
   if (statusCode != HttpStatus.SC_OK) {
    return "緩存清除不成功!";
   }else{    
    return "緩存清除成功!" ;
   } 
  } catch (Exception e) {
   e.printStackTrace();
  } 
  return null;
 }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章