How can I Invalidate a http session by using session id The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow can i load Java HttpSession from JSESSIONID?PUT vs. POST in RESTHTTP GET with request bodyHTTP status code for update and delete?How to use java.net.URLConnection to fire and handle HTTP requestsHow do servlets work? Instantiation, sessions, shared variables and multithreadingCustom HTTP headers : naming conventionsapplication/x-www-form-urlencoded or multipart/form-data?Do sessions really violate RESTfulness?How to directly initialize a HashMap (in a literal way)?How are parameters sent in an HTTP POST request?
Do working physicists consider Newtonian mechanics to be "falsified"?
Can the DM override racial traits?
Why does the Event Horizon Telescope (EHT) not include telescopes from Africa, Asia or Australia?
What are these Gizmos at Izaña Atmospheric Research Center in Spain?
How do you keep chess fun when your opponent constantly beats you?
Why did all the guest students take carriages to the Yule Ball?
Mortgage adviser recommends a longer term than necessary combined with overpayments
How can I define good in a religion that claims no moral authority?
How does this infinite series simplify to an integral?
ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?
How to copy the contents of all files with a certain name into a new file?
Did the new image of black hole confirm the general theory of relativity?
What aspect of planet Earth must be changed to prevent the industrial revolution?
Does Parliament need to approve the new Brexit delay to 31 October 2019?
University's motivation for having tenure-track positions
He got a vote 80% that of Emmanuel Macron’s
Was credit for the black hole image misattributed?
How to prevent selfdestruct from another contract
How are presidential pardons supposed to be used?
How can I protect witches in combat who wear limited clothing?
How to delete random line from file using Unix command?
In horse breeding, what is the female equivalent of putting a horse out "to stud"?
First use of “packing” as in carrying a gun
Button changing its text & action. Good or terrible?
How can I Invalidate a http session by using session id
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow can i load Java HttpSession from JSESSIONID?PUT vs. POST in RESTHTTP GET with request bodyHTTP status code for update and delete?How to use java.net.URLConnection to fire and handle HTTP requestsHow do servlets work? Instantiation, sessions, shared variables and multithreadingCustom HTTP headers : naming conventionsapplication/x-www-form-urlencoded or multipart/form-data?Do sessions really violate RESTfulness?How to directly initialize a HashMap (in a literal way)?How are parameters sent in an HTTP POST request?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am logged in with a different user account, but I have hashmap with the created http session id's in it and I need to invalidate an http session by using sessionid.
Is there any way to do that?
java http session tomcat servlets
add a comment |
I am logged in with a different user account, but I have hashmap with the created http session id's in it and I need to invalidate an http session by using sessionid.
Is there any way to do that?
java http session tomcat servlets
Make a servlet that closes its session, then do an http request with the session id.
– Maurice Perry
Mar 22 at 6:32
Possible duplicate of How can i load Java HttpSession from JSESSIONID?
– SirFartALot
Mar 28 at 14:27
add a comment |
I am logged in with a different user account, but I have hashmap with the created http session id's in it and I need to invalidate an http session by using sessionid.
Is there any way to do that?
java http session tomcat servlets
I am logged in with a different user account, but I have hashmap with the created http session id's in it and I need to invalidate an http session by using sessionid.
Is there any way to do that?
java http session tomcat servlets
java http session tomcat servlets
edited Mar 22 at 6:21
user11235845
asked Mar 22 at 6:15
shanshan
13210
13210
Make a servlet that closes its session, then do an http request with the session id.
– Maurice Perry
Mar 22 at 6:32
Possible duplicate of How can i load Java HttpSession from JSESSIONID?
– SirFartALot
Mar 28 at 14:27
add a comment |
Make a servlet that closes its session, then do an http request with the session id.
– Maurice Perry
Mar 22 at 6:32
Possible duplicate of How can i load Java HttpSession from JSESSIONID?
– SirFartALot
Mar 28 at 14:27
Make a servlet that closes its session, then do an http request with the session id.
– Maurice Perry
Mar 22 at 6:32
Make a servlet that closes its session, then do an http request with the session id.
– Maurice Perry
Mar 22 at 6:32
Possible duplicate of How can i load Java HttpSession from JSESSIONID?
– SirFartALot
Mar 28 at 14:27
Possible duplicate of How can i load Java HttpSession from JSESSIONID?
– SirFartALot
Mar 28 at 14:27
add a comment |
2 Answers
2
active
oldest
votes
There is no standard way to remove a session only knowing the session id.
Maybe you can trick the server by sending the fake session id (as cookie or http-parameter) to take over one other's session and try to invalidate it with some of the application's methods (e.g. "logout").
But there is not a JSP or something within tomcat, which can do this.
If you want to invalidate sessions in an application you deploy on that server, you might be interested in How can i load Java HttpSession from JSESSIONID?
add a comment |
You can use under given method
session.invalidate();
OR you can remove all attributes from session and invalidate
Enumeration<String> attributes = request.getSession().getAttributeNames();
while (attributes.hasMoreElements())
String attribute = attributes.nextElement();
session.removeAttribute(attribute);
session.invalidate();
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293901%2fhow-can-i-invalidate-a-http-session-by-using-session-id%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no standard way to remove a session only knowing the session id.
Maybe you can trick the server by sending the fake session id (as cookie or http-parameter) to take over one other's session and try to invalidate it with some of the application's methods (e.g. "logout").
But there is not a JSP or something within tomcat, which can do this.
If you want to invalidate sessions in an application you deploy on that server, you might be interested in How can i load Java HttpSession from JSESSIONID?
add a comment |
There is no standard way to remove a session only knowing the session id.
Maybe you can trick the server by sending the fake session id (as cookie or http-parameter) to take over one other's session and try to invalidate it with some of the application's methods (e.g. "logout").
But there is not a JSP or something within tomcat, which can do this.
If you want to invalidate sessions in an application you deploy on that server, you might be interested in How can i load Java HttpSession from JSESSIONID?
add a comment |
There is no standard way to remove a session only knowing the session id.
Maybe you can trick the server by sending the fake session id (as cookie or http-parameter) to take over one other's session and try to invalidate it with some of the application's methods (e.g. "logout").
But there is not a JSP or something within tomcat, which can do this.
If you want to invalidate sessions in an application you deploy on that server, you might be interested in How can i load Java HttpSession from JSESSIONID?
There is no standard way to remove a session only knowing the session id.
Maybe you can trick the server by sending the fake session id (as cookie or http-parameter) to take over one other's session and try to invalidate it with some of the application's methods (e.g. "logout").
But there is not a JSP or something within tomcat, which can do this.
If you want to invalidate sessions in an application you deploy on that server, you might be interested in How can i load Java HttpSession from JSESSIONID?
answered Mar 28 at 14:33
SirFartALotSirFartALot
33612
33612
add a comment |
add a comment |
You can use under given method
session.invalidate();
OR you can remove all attributes from session and invalidate
Enumeration<String> attributes = request.getSession().getAttributeNames();
while (attributes.hasMoreElements())
String attribute = attributes.nextElement();
session.removeAttribute(attribute);
session.invalidate();
add a comment |
You can use under given method
session.invalidate();
OR you can remove all attributes from session and invalidate
Enumeration<String> attributes = request.getSession().getAttributeNames();
while (attributes.hasMoreElements())
String attribute = attributes.nextElement();
session.removeAttribute(attribute);
session.invalidate();
add a comment |
You can use under given method
session.invalidate();
OR you can remove all attributes from session and invalidate
Enumeration<String> attributes = request.getSession().getAttributeNames();
while (attributes.hasMoreElements())
String attribute = attributes.nextElement();
session.removeAttribute(attribute);
session.invalidate();
You can use under given method
session.invalidate();
OR you can remove all attributes from session and invalidate
Enumeration<String> attributes = request.getSession().getAttributeNames();
while (attributes.hasMoreElements())
String attribute = attributes.nextElement();
session.removeAttribute(attribute);
session.invalidate();
answered Mar 22 at 6:43
VirenViren
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293901%2fhow-can-i-invalidate-a-http-session-by-using-session-id%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Make a servlet that closes its session, then do an http request with the session id.
– Maurice Perry
Mar 22 at 6:32
Possible duplicate of How can i load Java HttpSession from JSESSIONID?
– SirFartALot
Mar 28 at 14:27