【发布时间】:2013-01-06 09:34:59
【问题描述】:
以下代码将从 appengine 应用(在本例中为自定义域)和 google.com 中注销用户:
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
UserService userService = UserServiceFactory.getUserService();
String thisURL = req.getRequestURI();
resp.setContentType("text/html");
if (req.getUserPrincipal() != null) {
resp.getWriter().println("<p>Hello, " +
req.getUserPrincipal().getName() +
"! You can <a href=\"" +
userService.createLogoutURL(thisURL) +
"\">sign out</a>.</p>");
}
}
}
我们如何才能只从 appengine 应用中退出并让用户继续登录 google.com?
【问题讨论】: