首页 > 其他 > 详细

tomcat笔记

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

重启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笔记

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!