QQ或者微薄登录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import com.qq.connect.QQConnectException; import com.qq.connect.api.OpenID; import com.qq.connect.api.qzone.UserInfo; import com.qq.connect.javabeans.AccessToken; import com.qq.connect.oauth.Oauth; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import weibo4j.Account; import weibo4j.Users; import weibo4j.model.WeiboException; import weibo4j.org.json.JSONException; @RequestMapping("/oauth/checkqq.jspx") public void checkqq(String uid, String from, HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model modelMap) { try { response.sendRedirect(new Oauth().getAuthorizeURL(request)); } catch (IOException e) { e.printStackTrace(); } catch (QQConnectException e) { e.printStackTrace(); } } @RequestMapping("/oauth/checkweibo.jspx") public void checkweibo(String uid, String from, HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model modelMap) { try { response.sendRedirect(new weibo4j.Oauth().authorize("code")); } catch (IOException e) { e.printStackTrace(); } catch (WeiboException e) { e.printStackTrace(); } } |