码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat笔记

时间:2015-04-16 17:49:46      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:重启tomcat应用   重启tomcat服务   java操作tomcat   

重启Tomcat应用:

  public String reloadApp(){
		String url="http://localhost:1081/manager/reload?path=/app";
		return remoteLogin(url,"admin", "admin");
	}
	
	public String remoteLogin(String url,String username,String password){
		HttpClient client = new HttpClient( );
		HttpMethod method = new GetMethod( url );
		Credentials credentials =  new UsernamePasswordCredentials( username,password );
		client.getState().setCredentials( null, null, credentials );
		try {
			client.executeMethod( method );
			String response = method.getResponseBodyAsString( );
			method.releaseConnection( );
			return response;
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return "请示失败";
	}


未完,待续…………

tomcat笔记

标签:重启tomcat应用   重启tomcat服务   java操作tomcat   

原文地址:http://blog.csdn.net/ztt_1119/article/details/45076091

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!