GAE 注销 url 出现错误 404

发布于 2024-09-10 06:10:05 字数 552 浏览 2 评论 0原文

我的基于 GAE java 的应用程序仅使用一个 google 用户 - 管理员。对于管理网页,我使用生成的注销 url

UserServiceFactory.getUserService().createLogoutURL("/")

生成的 url 末尾总是有一个 /zero,单击它会给出“错误 404 NOT_FOUND”。

I 问题出现在开发服务器和云上。在开发服务器上,生成的 url 始终类似于 - http://localhost:8080/myapp/myurl/ 0 ,当实际部署在云上时,它类似于 http://myapp.appspot.0 。 com/myapp/myurl/0

我想知道为什么生成的注销网址不起作用,是我做错了还是缺少某些配置?请帮忙。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

篱下浅笙歌 2024-09-17 06:10:05

检查您的 web.xml。您必须添加以下部分。

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

您可以用您的选择替换index.jsp。

编辑

我不知道你的应用程序有什么问题。这是我创建的一个测试应用程序。

http://rqtest123.appspot.com/

我的 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>

我认为你应该检查你的网站再次.xml。

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.

微暖i 2024-09-17 06:10:05

终于找到了!!!

早些时候,通过我的 spring 控制器,我将创建的注销 url 传递为

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

我的 JSP 代码看起来像 -

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

变量名称 logout-url 是问题所在。将其替换为 logoutUrl ,一切正常!变量名中不允许使用 -

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文