4 Replies Latest reply on Apr 6, 2015 4:28 PM by Paul Ferraro

    limit number of http sessions

    Mark Lybarger Apprentice

      i'd like to limit the number of http sessions in my application.  i thought i could set the following in jboss-web.xml




      to limit to one http session, but then i hit the app with two instances and both get a session created. 


      i used a simple jsp to create the session:

      <h2>Hello World!</h2>


      and i use jboss cli to verify the session count:

      [standalone@localhost:9990 /] /deployment=example.war/subsystem=undertow/:read-resource(include-runtime=
          "outcome" => "success",
          "result" => {
              "active-sessions" => 2,
              "context-root" => "/example",
              "server" => "default-server",
              "sessions-created" => 2,
              "virtual-host" => "default-host",
              "servlet" => undefined


      any ideas or help would be appreciated.  currently, i have an application that has manual session tracking and counting. that code seems volatile to me.  the servlet has a static variable that gets incremented when sessions are created and decremented when sessions are destroyed.  when they're over the max, the servlet handles the response.