use java reflection to make a lite-restful handler

This commit is contained in:
Sola
2016-03-03 01:37:47 +08:00
parent 4827621cc2
commit d81e9398b3
22 changed files with 446 additions and 771 deletions

View File

@@ -0,0 +1,32 @@
package love.sola.netsupport.api;
import love.sola.netsupport.enums.Access;
import love.sola.netsupport.wechat.Command;
import me.chanjar.weixin.common.session.WxSession;
import javax.servlet.http.HttpServletRequest;
/**
* ***********************************************
* Created by Sola on 2016/2/27.
* Don't modify this source without my agreement
* ***********************************************
*/
public abstract class API {
public String url = null; //url
public int access = Access.GOD_MODE; //operator's permission
public Command authorize = null; //session check
protected abstract Object process(HttpServletRequest req, WxSession session) throws Exception;
@Override
public String toString() {
return getClass().getSimpleName() + "{" +
"url='" + url + '\'' +
", access=" + Access.inverseMap.get(access) +
", authorize=" + authorize +
'}';
}
}