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;








0















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?










share|improve this question
























  • 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

















0















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?










share|improve this question
























  • 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













0












0








0


0






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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












2 Answers
2






active

oldest

votes


















0














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?






share|improve this answer






























    -1














    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();





    share|improve this answer























      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
      );



      );













      draft saved

      draft discarded


















      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









      0














      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?






      share|improve this answer



























        0














        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?






        share|improve this answer

























          0












          0








          0







          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?






          share|improve this answer













          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?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 14:33









          SirFartALotSirFartALot

          33612




          33612























              -1














              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();





              share|improve this answer



























                -1














                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();





                share|improve this answer

























                  -1












                  -1








                  -1







                  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();





                  share|improve this answer













                  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();






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 22 at 6:43









                  VirenViren

                  11




                  11



























                      draft saved

                      draft discarded
















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해