简体   繁体   English

GAE注销网址给出错误404

[英]GAE logout url giving error 404

My GAE java based application uses only one google user - the admin. 我的基于GAE Java的应用程序仅使用一个Google用户-管理员。 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'. 生成的url的末尾始终始终带有/ zero,单击它会显示“错误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 在开发服务器上,此生成的url始终看起来像-http:// localhost:8080 / myapp / myurl / 0 ,而实际上部署在云上时,它类似于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 ? 我想知道为什么生成的注销URL无法正常工作,是我做错了还是缺少某些配置? please help. 请帮忙。

Check your web.xml. 检查您的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. 您可以选择替换index.jsp。

Edit 编辑

I don't know what is wrong with your app. 我不知道您的应用程序有什么问题。 Here is a test app i have created. 这是我创建的测试应用。

http://rqtest123.appspot.com/ http://rqtest123.appspot.com/

My web.xml look like 我的web.xml看起来像

<?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. 我认为您应该再次检查web.xml。

Finally found it !!! 终于找到了!

Earlier, through my spring controller I was passing the created logout url as 之前,通过我的spring控制器,我将创建的注销URL传递为

model.put("logout-url", UserServiceFactory.getUserService().createLogoutURL("/"));

And my JSP code looked like - 我的JSP代码看起来像-

<a class="link" href="${logout-url}">Logout</a>

The variable name logout-url was the problem. 变量名logout-url是问题所在。 Replaced it with logoutUrl and everything worked fine ! logoutUrl替换它,一切正常! The - is not allowed in variable name. 变量名中不允许-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM