//创建一个微信菜单实体类
WeixinMenu.java
package com.weixin.menu;
import java.io.Serializable;
import java.util.Set;
public abstract class WeixinMenu implements Serializable {
// primary key
private Integer id;
// fields
private String name;
private String type;
private String url;
private String key;
// many to one
private WeixinMenu parent;
// collections
private java.util.Set child;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public WeixinMenu getParent() {
return parent;
}
public void setParent(WeixinMenu parent) {
this.parent = parent;
}
public Set getChild() {
return child;
}
public void setChild(Set child) {
this.child = child;
}
public String toString() {
return super.toString();
}
}
//控制器方法
WeixinMenuAct.java
package com.weixin.menu;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;