1.运行类
2.action
public static void main(String[] args) {
String url = "http://127.0.0.1:8080/reload.action";
HttpClient client = new DefaultHttpClient();
HttpMethod method = getPostMethod();//使用POST方式提交数据
HttpUriRequest m=new HttpPost(url);
m.setHeader("Cookie","ceshi3.com=*****");
HttpResponse response;
try {
response=client.execute(m);
System.out.println(response.getEntity().getContent().read()+"---"+response.getStatusLine());
} catch (IOException e) {
e.printStackTrace();
}
//打印服务器返回的状态
System.out.println(method.getStatusLine());
method.releaseConnection();
}
2.action
public String reload() {
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getSession()
.getServletContext());
if (context.getParent() != null) {
((AbstractRefreshableApplicationContext) context.getParent()).refresh();
}
((AbstractRefreshableApplicationContext) context).refresh();
System.out.println("--------Spring Context Reload----------------");
return null;
}