当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Is there some way to delete session info from address line when redirecting?

问题描述:

I am using Wildfly, Spring MVC in my project.

And after redirecting to another page of my project - to my browser address line appears some session info like in this image:

p.s. When i were using Tomcat - there was no such problems.

Is there an optimal way to stop auto-adding session information in the address bar?

Thanks.

Update:

In the normal situation, when i were redirecting in my past projects(for example) from page "index" to page "login" i saw something like this: "myapp.com/login"

But now i saw:"myapp.com/login;jsessionid=nGTE5tfW3hUZZOP1yQTF4Mrh3PRbNu8UyY8UBkmx.coderunit".

I didn't made some special options to my app server to cancel this session info additions. Maybe there are some special tool for it.

网友答案:

I solved this problem. There is some spectial option for web.xml.

This is the default behavior of a servlet container. If the client doesn’t include a cookie in the first request, the container cannot tell whether the client supports cookies or not. Therefore the container embeds the session id in the URL.

You can disable this in your web.xml using the session-config element:

<session-config>
    <tracking-mode>COOKIE</tracking-mode>
</session-config>

It helped me. Good luck.

分享给朋友:
您可能感兴趣的文章:
随机阅读: