views:

62

answers:

2

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 is 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.

+2  A: 

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.

Manjoor
Its already there in my web.xml. The exact error I get is "HTTP ERROR 404Problem accessing /myapp/myurl/0. Reason:NOT_FOUND"
Gopi
Hey thanks for your efforts. I notice the logout url in your page as 'http://rqtest123.appspot.com/_ah/logout?continue=https://www.google.com/accounts/Logout%3Fcontinue%3Dhttp://rqtest123.appspot.com/%26service%3Dah'. While in my case this url itself is coming incorrect as I mentioned in my question.
Gopi
can you provide me url of your app?
Manjoor
Sorry but I cannot provide url of app because as I mentioned it allows only one user - the admin and no one else will be able to access it. I will try to reproduce it in some other test deployment and check out.
Gopi
+1 Thanks for your help. The problem was weird as I posted in my answer.
Gopi
+1  A: 

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.

Gopi