I am using following code:
@SuppressWarnings("serial")
public class GuestbookServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/plain");
PrintWriter out = resp.getWriter();
out.println("This is my first Google App");
//----Google User Account Service---//
try{
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user != null) {
out.println("Hello, " + user.getNickname());
out.println("<a href='"+userService.createLogoutURL("http://
localhost:8888")+"'>Logout</a>");
} else {
resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
}
}catch(Exception ex){
out.println(ex.getMessage());
}
}
}
hit http://localhost:8888/appname
enter email address like [email protected], and put a comma " , " at the
end of email it produces following exception.. how to validate the
email so that it should not produce exception. and when i enter comma
email address it shows HTTP 500 Internal Server Error unless I washout
all the cookies so that session is lost.
Stack Trace:
java.lang.ArrayIndexOutOfBoundsException: 1
at
com.google.appengine.api.users.dev.LoginCookieUtils.parseCookie(LoginCookieUtils.java:
111)
at
com.google.appengine.api.users.dev.LoginCookieUtils.getCookieData(LoginCookieUtils.java:
80)
at
com.google.appengine.tools.development.LocalHttpRequestEnvironment.<init>(LocalHttpRequestEnvironment.java:
42)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:345)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.