Exit from HttpClient session

烂漫一生 提交于 2019-11-30 20:12:15

You may use a workaround – to send a request to a new user with a new cookieStore.

// Create a local instance of cookie store
cookieStore = new BasicCookieStore();
// Set the store
httpClient.setCookieStore(cookieStore);

Server will open a new session to your new user. Please note that the old session will NOT be closed. I do not recommend to use this way.

The session management is performed on the server side – you can not do it on the client side. I recommend in the end of your test you should call to a server URL that will invalidate a session on the server side. (Generally applications that use Form authentication have a logout functionality and you just need to use it)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!