read session timeout from web.xml

Discussion in 'Java' started by Jim, Oct 31, 2006.

  1. Jim

    Jim Guest

    How can I obtain the timeout value I set

    <session-config>
    <session-timeout>2</session-timeout>
    </session-config>

    in my web.xml programatically in a servlet?

    thanks

    mark
     
    Jim, Oct 31, 2006
    #1
    1. Advertising

  2. I think it's one of ServletContext.getAttribute() or
    ServletConfig.getInitParameter() , use getInitParameterNames() to get
    all possible names.

    see API doc http://java.sun.com/products/servlet/2.2/javadoc/

    WuyaSea Operator
    http://www.wuyaSea.com/board/280/java , answer question - earn cash.


    Jim wrote:
    > How can I obtain the timeout value I set
    >
    > <session-config>
    > <session-timeout>2</session-timeout>
    > </session-config>
    >
    > in my web.xml programatically in a servlet?
    >
    > thanks
    >
    > mark
     
    WuyaSea Operator, Oct 31, 2006
    #2
    1. Advertising

  3. Jim

    Wesley Hall Guest

    Jim wrote:
    > How can I obtain the timeout value I set
    >
    > <session-config>
    > <session-timeout>2</session-timeout>
    > </session-config>
    >
    > in my web.xml programatically in a servlet?


    I believe the method getMaxInactiveInterval() on HttpSession will do
    what you require.
     
    Wesley Hall, Oct 31, 2006
    #3
  4. Jim

    Jim Guest

    Wesley Hall wrote:
    > Jim wrote:
    > > How can I obtain the timeout value I set
    > >
    > > <session-config>
    > > <session-timeout>2</session-timeout>
    > > </session-config>
    > >
    > > in my web.xml programatically in a servlet?

    >
    > I believe the method getMaxInactiveInterval() on HttpSession will do
    > what you require.


    Jim, getMaxInactiveInterval worked. Thanks
     
    Jim, Nov 1, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    2
    Views:
    6,403
  2. Jim
    Replies:
    0
    Views:
    390
  3. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,346
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  4. Replies:
    7
    Views:
    955
    Arne Vajhøj
    Apr 24, 2009
  5. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,308
    Brian Candler
    Oct 6, 2004
Loading...

Share This Page