当前位置:   article > 正文

java 微信 图灵机器人_微信开发基于图灵机器人智能回复

图灵机器人接入微信java

【实例简介】调用图灵机器人借口,在微信实现智能回复功能

【实例截图】

【核心代码】

package servlet;

import org.sword.wechat4j.token.AccessTokenProxy;

import service.Lejian;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

/**

* Created by Administrator on 2016/11/16.

*/

public class WechatServlet extends HttpServlet {

public WechatServlet(){

super();

}

@Override

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

System.out.print("hello");

Lejian lejian=new Lejian(request);

// wechat调用入口,进行数据接收,事件分发

String result=lejian.execute();

response.getOutputStream().write(result.getBytes());

}

@Override

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

request.setCharacterEncoding("utf-8");

response.setCharacterEncoding("utf-8");

response.setContentType("text/html;charset=utf-8");

Lejian lejian=new Lejian(request);

// wechat调用入口,进行数据接收,事件分发

String result=lejian.execute();

response.getOutputStream().write(result.getBytes());

}

}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/178510?site
推荐阅读
相关标签
  

闽ICP备14008679号