json学习类4 try { Method set = InterfaceJsonAction.class.getDeclaredMethod( methodName, Map.class); return set.invoke(this, map); } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return new JsonResponse(Constants.RESULT_1001); } // 获
map) { String userid = map.get("userid"); String currentTime = String.valueOf(System.currentTimeMillis()); tokenMap.put(userid, currentTime); return currentTime; } // 验证token
map) { String userid = map.get("userid"); String token = map.get("token"); try { return !Util.isEmpty(token) && !Util.isEmpty(tokenMap.get(userid)) && token.equals(MD5.crypt(tokenMap.get(userid))); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return false; } finally { tokenMap.remove(userid); } }
分享到: