WebLogic如何設置session超時時間

WebLogic如何設置session超時時間

1 web.xml


設置WEB應用程序描述符web.xml裏的<session-timeout>元素。這個值以分鐘爲
單位,並覆蓋weblogic.xml中的TimeoutSecs屬性
<session-config>
    <session-timeout>54</session-timeout>
</session-config>
此例表示Session將在54分鐘後過期
當<session-timeout>設置爲-2,表示將使用在weblogic.xml中設置的
TimeoutSecs這個屬性值。
當<session-timeout>設置爲-1,表示Session將永不過期,而忽略在
weblogic.xml中設置的TimeoutSecs屬性值。
該屬性值可以通過console控制檯來設置

2 weblogic.xml

設置WebLogic特有部署描述符weblogic.xml的<session-descriptor>元素的
TimeoutSecs屬性。這個值以秒爲單位
<session-descriptor>
   <session-param>
      <param-name>TimeoutSecs</param-name>
      <param-value>3600</param-value>
   </session-param>
</session-descriptor>
默認值是3600秒

3,jsp中控制

session.setmaxinactiveinterval(7200);

session是默認對象,可以直接引用,單位秒s


4,servlet中控制

httpsession session = request.getsession();

session.setmaxinactiveinterval(7200);

單位秒s

在weblgoic的console中:xxDomain->Servers->xxServer->Protocols->HTTP 中有一個關於Post Timeout的配置,但這個參數一般使用默認值即可

一般是通過Services-->JDBC-->Connection Pools-->MyConnection(你所建立的連接池名)-->Configration-->Connections 裏的Inactive Connection Timeout這個參數來設置的,默認的爲0,表示連接時間無限長。你可以設一個時間值,連接超過這個時間值,它會把連接強制放回連接池

<Server AcceptBacklog="62" CompleteHTTPMessageTimeout="480"
CompleteMessageTimeout="480" IdleC
ListenAddress="" ListenPort="7001" Name="myserver"
NativeIOEnabled="true" ReliableDeliveryPolicy="RMDefaultPolicy"
ServerVersion="8.1.4.0">
是否IdleConnectionTimeout參數

看連接池中高級選項內的Inactive Connection Timeout和Connection Reserve Timeout時多少, 把這兩項設大些試試
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章