我尝试使用身份验证此说明部署我的应用程序:
<application>mytestapp</application>
<version>1</version>
<sessions-enabled>true</sessions-enabled>
<security-constraint>
<web-resource-collection>
<web-resource-name></web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
我也尝试了这段代码来让用户登录:
public class GuestbookServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user != null) {
resp.setContentType("text/plain");
resp.getWriter().println("Hello, " + user.getNickname());
} else {
resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
}
}
}
...但由于某种原因,我在XML 验证错误时抛出异常:
在“将 testapp 部署到 Google”期间发生内部错误。针对 C:...\eclipse-jee-indigo-win32\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1 验证 C:...\testapp\war\WEB-INF\appengine-web.xml 的 XML 错误.5.2.r37v201107211953\appengine-java-sdk-1.5.2\docs\appengine-web.xsd
我不太确定这意味着什么,所以我非常需要你的建议如何解决它?非常感谢任何有用的想法。
谢谢
PS GWT SDK 2.3