本文整理汇总了Java中com.jfinal.core.Controller.renderText方法的典型用法代码示例。如果您正苦于以下问题:Java Controller.renderText方法的具体用法?Java Controller.renderText怎么用?Java Controller.renderText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfinal.core.Controller
的用法示例。
在下文中一共展示了Controller.renderText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSignature
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 检测签名
*/
private boolean checkSignature(Controller controller) {
String signature = controller.getPara("signature");
String timestamp = controller.getPara("timestamp");
String nonce = controller.getPara("nonce");
if (StrKit.isBlank(signature) || StrKit.isBlank(timestamp) || StrKit.isBlank(nonce)) {
controller.renderText("check signature failure");
return false;
}
if (SignatureCheckKit.me.checkSignature(signature, timestamp, nonce)) {
return true;
}
else {
log.error("check signature failure: " +
" signature = " + controller.getPara("signature") +
" timestamp = " + controller.getPara("timestamp") +
" nonce = " + controller.getPara("nonce"));
return false;
}
}
示例2: configServer
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 配置开发者中心微信服务器所需的 url 与 token
* @return true 为config server 请求,false 正式消息交互请求
*/
public void configServer(Controller c) {
String msg_signature = c.getPara("msg_signature");
String timestamp = c.getPara("timestamp");
String nonce = c.getPara("nonce");
String echostr = c.getPara("echostr");
//非加密验证
boolean isOk = SignatureCheckKit.me.checkSignature(msg_signature, timestamp, nonce,echostr);
if (isOk){
WxCryptUtil pc = getWxCryptUtil();
echostr= pc.decrypt(echostr);
log.info("验证成功,解密后的echostr:"+echostr);
c.renderText(echostr);
}
else
log.error("验证失败:configServer!");
}
示例3: checkSignature
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 检测签名
*/
private boolean checkSignature(Controller controller) {
String signature = controller.getPara("signature");
String timestamp = controller.getPara("timestamp");
String nonce = controller.getPara("nonce");
if (StrKit.isBlank(signature) || StrKit.isBlank(timestamp) || StrKit.isBlank(nonce)) {
controller.renderText("check signature failure");
return false;
}
if (SignatureCheckKit.me.checkSignature(signature, timestamp, nonce)) {
return true;
}
else {
logger.error("check signature failure: " +
" signature = " + controller.getPara("signature") +
" timestamp = " + controller.getPara("timestamp") +
" nonce = " + controller.getPara("nonce"));
return false;
}
}
示例4: intercept
import com.jfinal.core.Controller; //导入方法依赖的package包/类
public void intercept(Invocation inv) {
Controller controller = inv.getController();
if (!(controller instanceof MsgController))
throw new RuntimeException("控制器需要继承 MsgController");
// 如果是服务器配置请求,则配置服务器并返回
if (isConfigServerRequest(controller)) {
configServer(controller);
return ;
}
// 签名检测
if (checkSignature(controller)) {
inv.invoke();
} else {
controller.renderText("签名验证失败,请确定是微信服务器在发送消息过来");
}
}
示例5: checkSignature
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 检测签名
*/
private boolean checkSignature(Controller c) {
String signature = c.getPara("signature");
String timestamp = c.getPara("timestamp");
String nonce = c.getPara("nonce");
if (StrKit.isBlank(signature) || StrKit.isBlank(timestamp) || StrKit.isBlank(nonce)) {
c.renderText("check signature failure");
return false;
}
if (SignatureCheckUtil.checkSignature(WcCache.getWxBase("").getToken(), signature, timestamp, nonce)) {
return true;
} else {
logger.error("check signature failure: " +
" signature = " + c.getPara("signature") +
" timestamp = " + c.getPara("timestamp") +
" nonce = " + c.getPara("nonce"));
return false;
}
}
示例6: intercept
import com.jfinal.core.Controller; //导入方法依赖的package包/类
public void intercept(ActionInvocation ai) {
Controller controller = ai.getController();
if (controller instanceof MsgController == false)
throw new RuntimeException("控制器需要继承 MsgController");
try {
// 将 ApiConfig 对象与当前线程绑定,以便在后续操作中方便获取该对象: ApiConfigKit.getApiConfig();
ApiConfigKit.setThreadLocalApiConfig(((MsgController)controller).getApiConfig());
// 如果是服务器配置请求,则配置服务器并返回
if (isConfigServerRequest(controller)) {
configServer(controller);
return ;
}
// 签名检测
if (checkSignature(controller)) {
ai.invoke();
}
else {
controller.renderText("check signature failure");
}
}
finally {
ApiConfigKit.removeThreadLocalApiConfig();
}
}
示例7: configServer
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 配置开发者中心微信服务器所需的 url 与 token
* @return true 为config server 请求,false 正式消息交互请求
*/
public void configServer(Controller c) {
// 通过 echostr 判断请求是否为配置微信服务器回调所需的 url 与 token
String echostr = c.getPara("echostr");
String signature = c.getPara("signature");
String timestamp = c.getPara("timestamp");
String nonce = c.getPara("nonce");
boolean isOk = SignatureCheckKit.me.checkSignature(signature, timestamp, nonce);
if (isOk)
c.renderText(echostr);
else
log.error("验证失败:configServer");
}
示例8: checkSignature
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 检测微信加密签名
* msg_signature结合了企业填写的token、请求中的timestamp、nonce参数、加密的消息体
*/
private boolean checkSignature(Controller controller) {
String msg_signature = controller.getPara("msg_signature");
String timestamp = controller.getPara("timestamp");
String nonce = controller.getPara("nonce");
if (StrKit.isBlank(msg_signature) || StrKit.isBlank(timestamp) || StrKit.isBlank(nonce)) {
controller.renderText("check signature failure. (msg_sigature|timestamp|none) not exist ");
return false;
}
return true;
}
示例9: intercept
import com.jfinal.core.Controller; //导入方法依赖的package包/类
public void intercept(Invocation inv) {
Controller controller = inv.getController();
if (controller instanceof MsgController == false)
throw new RuntimeException("控制器需要继承 MsgController");
try {
// 将 ApiConfig 对象与当前线程绑定,以便在后续操作中方便获取该对象: ApiConfigKit.getApiConfig();
ApiConfigKit.setThreadLocalApiConfig(((MsgController)controller).getApiConfig());
// 如果是服务器配置请求,则配置服务器并返回
if (isConfigServerRequest(controller)) {
configServer(controller);
return ;
}
// 对开发测试更加友好
if (ApiConfigKit.isDevMode()) {
inv.invoke();
} else {
// 如果是服务器配置请求,则配置服务器并返回
if (isConfigServerRequest(controller)) {
configServer(controller);
return ;
}
// 签名检测
if (checkSignature(controller)) {
inv.invoke();
}
else {
controller.renderText("签名验证失败,请确定是微信服务器在发送消息过来");
}
}
}
finally {
ApiConfigKit.removeThreadLocalApiConfig();
}
}
示例10: configServer
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 配置开发者中心微信服务器所需的 url 与 token
* @return true 为config server 请求,false 正式消息交互请求
*/
public void configServer(Controller c) {
// 通过 echostr 判断请求是否为配置微信服务器回调所需的 url 与 token
String echostr = c.getPara("echostr");
String signature = c.getPara("signature");
String timestamp = c.getPara("timestamp");
String nonce = c.getPara("nonce");
boolean isOk = SignatureCheckKit.me.checkSignature(signature, timestamp, nonce);
if (isOk)
c.renderText(echostr);
else
logger.error("验证失败:configServer");
}
示例11: configServer
import com.jfinal.core.Controller; //导入方法依赖的package包/类
/**
* 配置开发者中心微信服务器所需的 url 与 token
* true 为config server 请求,false 正式消息交互请求
*/
public void configServer(Controller c) {
// 通过 echostr 判断请求是否为配置微信服务器回调所需的 url 与 token
String echostr = c.getPara("echostr");
String signature = c.getPara("signature");
String timestamp = c.getPara("timestamp");
String nonce = c.getPara("nonce");
boolean isOk = SignatureCheckUtil.checkSignature(WcCache.getWxBase("").getToken(), signature, timestamp, nonce);
if (isOk)
c.renderText(echostr);
else
logger.error("验证失败:configServer");
}
示例12: handleError
import com.jfinal.core.Controller; //导入方法依赖的package包/类
@Override
protected void handleError(Controller c) {
// TODO Auto-generated method stub
RestfulResponse rr = new RestfulResponse();
rr.setDesc("缺少查询关键字");
rr.setRet(false);
c.renderText(new Gson().toJson(rr));
}
示例13: handleError
import com.jfinal.core.Controller; //导入方法依赖的package包/类
@Override
protected void handleError(Controller c) {
// TODO Auto-generated method stub
RestfulResponse rr = new RestfulResponse();
rr.setRet(false);
rr.setDesc("Error");
c.renderText(new Gson().toJson(rr));
}
示例14: handleError
import com.jfinal.core.Controller; //导入方法依赖的package包/类
@Override
protected void handleError(Controller c) {
// TODO Auto-generated method stub
//c.renderFreeMarker("/templates/error.html");
c.renderText("Error");
}
示例15: handleError
import com.jfinal.core.Controller; //导入方法依赖的package包/类
@Override
protected void handleError(Controller c) {
// TODO Auto-generated method stub
c.renderText("Lack of parameter");
}