Willy
Willy

Reputation: 1838

How to set session timeout with Grizzly 2.2.X?

I am using embedded Grizzly 2.2.X web server. I want to know where I can set the session-config for default session timeout. It is easy to do such thing with normal web containers. However I still found nowhere to do this with Grizzly.

Upvotes: 1

Views: 1286

Answers (2)

rlubke
rlubke

Reputation: 985

You can call setMaxInactiveInterval(int) on the HttpSession object. It's probably easiest, since Grizzly 2.2.x doesn't currently using a deployment descriptor, to call setMaxInactiveInterval() within HttpSessionListener.sessionCreated().

Upvotes: 1

TheWhiteRabbit
TheWhiteRabbit

Reputation: 15758

GrizzlyWebServer server;

//do your things

server.getSelectorThread().setKeepAliveTimeoutInSeconds(timeoutSeconds);

Upvotes: 1

Related Questions