我正在尝试使用 javax servlet 将 java 中的桌面应用程序连接到 Google 应用程序引擎。但我不知道该怎么办。
登录的网络服务器管理器是这样的
public class UserServicesP3Servlet extends HttpServlet
{
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
doGet(req,resp);
}
在浏览器中我使用连接
else if(address.indexOf("/dinamicas/login")!=-1)
{
StringMaisAutenticado sma = Autenticacao.login(req,resp,param1,param2);
resposta = sma.string;
utilizadorAutenticado = sma.utilizadorAutent;
}
我不太确定在桌面上做什么才能登录。有人能指出我正确的方向吗?
感谢您的宝贵时间。
最佳答案
您可以在three ways中调整应用程序的身份验证选项:
- 使用 Google 帐户
- Google 应用的用户
- 使用 OpenID
根据您的情况,您可以对用户进行身份验证,例如
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user == null)
response.sendRedirect("/index.jsp");
接下来您可以使用 AuthSub 授权对其数据的访问或OAuth .
我希望这会有所帮助。
关于Java 桌面应用程序连接到 GAE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6477710/