My GAE java based application uses only one google user - the admin. For the admin web pages I generate the logout url using
UserServiceFactory.getUserService().createLogoutURL("/")
The generated url is always having a /zero at the end and clicking on it gives 'Error 404 NOT_FOUND'.
I The problem occurs on development server as well as the cloud. On dev server, this generated url i开发者_运维知识库s always looking like - http://localhost:8080/myapp/myurl/0 and when actually deployed on cloud it is similar http://myapp.appspot.com/myapp/myurl/0
I wonder why logout url generated is not working, is it something I am doing wrong or missing some configuration ? please help.
Check your web.xml. You have to add following section.
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
You can replace index.jsp with your choice.
Edit
I don't know what is wrong with your app. Here is a test app i have created.
http://rqtest123.appspot.com/
My web.xml look like
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
I think you shoul check your web.xml again.
Finally found it !!!
Earlier, through my spring controller I was passing the created logout url as
model.put("logout-url", UserServiceFactory.getUserService().createLogoutURL("/"));
And my JSP code looked like -
<a class="link" href="${logout-url}">Logout</a>
The variable name logout-url
was the problem. Replaced it with logoutUrl
and everything worked fine ! The -
is not allowed in variable name.
精彩评论