This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.gson.Gson; | |
/** | |
* 登録機能などでクライアント側からのJSON形式のデータを | |
* Javaオブジェクトに変換する | |
* ※inputは連想配列形式のJSONデータ | |
*/ | |
// 入力複数データをまとめて取得 | |
String input = request.getParameter("input"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.gson.Gson; | |
/** | |
* 検索機能などでDBから値を取得し、クライアント側にリストを返すとき、 | |
* Javaオブジェクトでは返せないため、JSON形式に変換する | |
* ※dblistはDBから取得した<ArrayList<String>> | |
*/ | |
// Gsonオブジェクトを作成 | |
Gson gson = new Gson(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 認証情報 | |
AccessToken = 'Bearer ???=' -- ???に自分のChannel Access Token 変更箇所1 | |
-- 受信メッセージから送信メッセージを構築 | |
body = json.parse(request.body) | |
reply = body.events[1].replyToken -- 返信先 | |
inBoxMessage = body.events[1].message.text -- 受信メッセージ | |
-- 返答パターン | |
-- resTable['ここに書いたキーワードがLINEで入力されると'] = 'これが返されます' |