简体   繁体   中英

How to use session id in url with jboss 7?

I using Openjdk 7 and JBoss 7.

I can use sessions with cookies good. Some of clients have not ability to use cookie so i need to pass session id to server via URL. When i try to do so, session can't be initialized (i turned off cookies to test). I used different variables in url to pass session id like: sessionID, jsessionid, sid, but no one helped to initialize session by provided id.

So the question is what variable should contain session id in url when client can't use cookies, and how to setup jboss server to accept session id from url?

You should not modify the URLs directly. The trick to make that work is to ALWAYS use the response.encodeURL() or response.encodeRedirectURL() methods when generating URLs. See the javadoc here .

The JSTL <c:url> tag uses this method internally to generate URLs. So it's safe to use it.

These methods will append the session ID to the URL if needed. Note that to make them work, cookies must be disabled when the session is first created. If you create the session while cookies are enabled, and then disable cookies, it won't work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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