How to get all active session id's

hai,
i am new to servlet. i am tring to find out all active session id's for security perpose.
and also i want to deactive a perticular session using that session id.
but i don't know how to do. please help me.
thanks in advance.

Well to me.. I wud like to write a Listener class implementing HttpSessionListener in the following way....
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
import java.util.HashMap;
public class SessionHandler implements HttpSessionListener{
public static HashMap<String,HttpSession> SessionsMap = new HashMap<String,HttpSession>();
public void sessionCreated(HttpSessionEvent se) {
SessionsMap.put(se.getSession().getId(),se.getSession());
public void sessionDestroyed(HttpSessionEvent se) {
SessionMap.remove(se.getSession().getId());
public static invalidateSession(String SessionId){
HttpSession session =  SessionsMap.get(SessionId);
SessionMap.remove(SessionId);
session.invalidate();
}Note:I'm assuming tht you are running the code on Jdk/jre 1.5+
However, i think its more of core way of implementing this specially usage of static members howevr @ the given situation can very well cater your resources.added to it you add ActivationListener depending on your requirement.
Hope this might help :)
REGARDS,
RaHuL

Similar Messages

  • How to get all active ajax requests ?

    I need to write javascript function that gets some information about all active (at this moment) ajax requests that are posted by RichFaces.

    Thanks.........
    This command is working fine for me .......
    Get-ADComputer -Filter {enabled -eq $true} -properties *|select Name, DNSHostName, OperatingSystem, LastLogonDate
    But i am getting lastLogonTimestamp value as below:-
    lastLogonTimestamp
    129596940132789000
    How can i correct it???

  • I want to get List of all active sessions in current system

    Hi experts
    How to get list of all active sessions in current system in any internal table along with details.
    A sample code wud be helpful
    Thanks in advance.

    try this code it might help u.
    Below report execution gets the active Session list to ABAP memory
    submit rsm04000_alv and return exporting list to memory.
    refresh: gt_listobj.
    Below FM get the List output from ABAP memory to gt_listobj in HEX
    call function 'LIST_FROM_MEMORY'
      tables
        listobject = gt_listobj
      exceptions
        not_found  = 1
        others     = 2.
    if sy-subrc <> 0. " Executed successfully ?
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    This FM converts ITAB gt_listobj from HEX to ASCII
    call function 'LIST_TO_ASCI'
      tables
        listasci           = it_list
        listobject         = gt_listobj
      exceptions
        empty_list         = 1
        list_index_invalid = 2
        others             = 3.
    if sy-subrc <> 0. " Executed successfully ?
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    This Shows the output in List format on screen
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
       i_structure_name                  = 'line'
      tables
        t_outtab                          = it_list
    exceptions
       program_error                     = 1
       others                            = 2.
    if sy-subrc <> 0. " Executed successfully ?
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

  • How to get the active application users IP address in R12 by sql command

    Hi ,
    I need to know how to get the active application users IP in R12 by sql command
    in order to kill any session by the IP address ?
    Am working on 12.1.3 Application
    And 11.2.0.3 Oracle Database
    Thanks

    936921 wrote:
    Am still couldn't found the IP address for the connected Application users.
    If there any select statement can help me with that?
    Really? Then how do you explain me finding the following docs from the links I referenced above?
    How To Find The IP Address Of The Client Machine From Where A Particular Forms User Is Connected ? (Doc ID 879092.1)
    How to Track IP Address of the Form Session in Oracle application 11i (Doc ID 878931.1)
    Where to find the Client IP Address for a Client in E-Business Suite? (Doc ID 1258415.1)
    How To Get The terminal ID For The Machine From Which A User Is Logged To E-Business Suite Applications (Doc ID 751658.1)
    Thanks,
    Hussein

  • RRB-How to get the activity description instead of WBS element in the bill

    Dear All,
    I am using RRB DIP profile to do my Resource related billing
    RRB-How to get the activity description instead of WBS element in the billing
    document.Now  iam able to get the cost and the quantity used as line items but instead of getting the respective line items in the invoice iam still getting the WBS
    element description for all the activities.Can some body guide me to overcome this problem.
    Assured reward points for your suggestions and help.
    Thanking you,
    Best regards,
    R.Srinivasan

    Dear All,
    Please can any body help me for the same.IT is urgent.I will award you points.
    thankyou,
    Best regards,
    R.Srinivasan

  • Count all active Session

    Hey all,
    I want to know how many users are on my site. So I tryed so count all activ session:
    int countActiveSessions = FacesContext.getCurrentInstance().
              getExternalContext().getSessionMap().size();But it returns allways 0. Is the method false or how can I count all sessions?
    Thanks for help

    You are OT. Your question concertn much more servlet than JavaServer Faces.
    Anyway sessionMap is not the map of all sessions. It is the map of your own session. With a session map you can retrieve the session attributes.
    Look there if you want count the active sessions:
    http://www.java.happycodings.com/Java_Servlets/code10.html

  • How to get all rows that are returned in inner sub query of select statemen

    If a sub query in select statement returns more than one row than how to get all those returned rows in the final
    output of the query .It will be all right if all column's value repeat and that multiple output of inner query comes
    in another column .
    How to get that ?

    As Frank said, you likely want a join, and likely an outer join to replicate the select in the projection. Something like:
    SELECT id,stat, section, USER_ID concerned_person
    FROM table_all,
      left join table2
        on room_id = sectoion and
           sur_role = 'r001'
    WHERE section IN (SELECT code
                      FROM t_area
                      WHERE dept= 'p002')An alternative, depending on where and how you are using the statement would be something like:
    SQL> WITH t AS (
      2    select 1 id from dual union all
      3    select 2 id from dual),
      4  t1 as (
      5    select 1 id, 'One' descr from dual union all
      6    select 1, 'Un' from dual union all
      7    select 1, 'Une' from dual)
      8  SELECT t.id, CURSOR(SELECT t1.id, t1.descr from t1
      9                      WHERE t1.id = t.id)
    10  FROM t;
                      ID CURSOR(SELECTT1.ID,T
                       1 CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
                      ID DESCR
                       1 One
                       1 Un
                       1 Une
                       2 CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    no rows selectedJohn

  • How to get all the values from the dropdown menu

    How to get all the values from the dropdown menu
    I need to be able to extract all values from the dropdown menu; I know how to get all those values as a string, but I need to be able to access each item; (the value in a dropdown menu will change dynamically)
    How do I get number of item is selection dropdown?
    How do I extract a ?name? for each value, one by one?
    How do I change a selection by referring to particular index of the item in a dropdown menu?
    Here is the Path to dropdown menu that I'm trying to access (form contains number of similar dropdowns)
    RSWApp.om.GetElementByPath "window(index=0).form(id=""aspnetForm"" | action=""advancedsearch.aspx"" | index=0).formelement[SELECT](name=""ctl00$MainContent$hardwareBrand"" | id=""ctl00_MainContent_hardwareBrand"" | index=16)", element
    Message was edited by: testtest

    The findElement method allows various attributes to be used to search. Take the following two examples for the element below:
    <Select Name=ProdType ID=testProd>
    </Select>
    I can find the element based on its name or any other attribute, I just need to specify what I am looking for. To find it by name I would do the following:
    Set x = RSWApp.om.FindElement("ProdType","SELECT","Name")
    If I want to search by id I could do the following:
    Set x = RSWApp.om.FindElement("testProd","SELECT","ID")
    Usually you will use whatever is available. Since the select element has no name or ID on the Empirix home page, I used the onChange attribute. You can use any attribute as long as you specify which one you are using (last argument in these examples)
    You can use the FindElement to grab links, text boxes, etc.
    The next example grabs from a link on a page
    Home
    Set x = RSWApp.om.FindElement("Home","A","innerText")
    I hope this helps clear it up.

  • How to get all users under an organizations?

    Hello everyone.
    Just want to know if anyone knows how to get all users under a particular organization.
    From the Search User form, I found they may kind of user such attribute conditions:
    MemberObjectGroup
    is in
    XXXX(organization)
    But unfortunately, the "is in" is not a valid AttributeConditionOperator, so besides using "recursive" self-written function, anyone knows any possible buit-in trick?

    Here is my solution:
    <Rule'>
        <RuleArgument name='organization'/>
        <RuleArgument name='context'/>
        <block>
            <defvar name='orgs'>
                <new class='java.util.ArrayList'/>
            </defvar>
            <invoke name='getChildObjectGroupNames'>
                <invoke name='getObject' class='com.waveset.ui.FormUtil'>
                    <ref>context</ref>
                    <s>ObjectGroup</s>
                    <ref>organization</ref>
                </invoke>
                <ref>orgs</ref>
            </invoke>
            <append name='orgs'>
                <ref>organization</ref>
            </append>
            <invoke name='getUsers' class='com.waveset.ui.FormUtil'>
                <ref>context</ref>
                <map>
                    <s>conditions</s>
                    <list>
                        <new class='com.waveset.object.AttributeCondition'>
                            <s>MemberObjectGroups</s>
                            <s>in</s>
                            <ref>orgs</ref>
                        </new>
                    </list>
                </map>
            </invoke>
        </block>
        <MemberObjectGroups>
            <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
        </MemberObjectGroups>
    </Rule>

  • How to get all INDEXes from a database

    How to get all INDEXes in a database? I need to store them in script file (.SQL). My database version is 10.2.0.3.0.
    Edited by: Iniyavan on Sep 18, 2009 1:39 PM

    --Thanks, Koppelaars. The second query works. But I'm unable to store in spool file. May be it's due to CLOBs in the output. I did the following:
    set head off
    set feedback off
    set linesize 32727
    set pagesize 50000
    spool c:\indexes.sql
    select dbms_metadata.get_ddl('INDEX',INDEX_NAME,'MYSCHEMA')
    from user_indexes;
    spool off
    --In the spool file, I find only this
    CREATE UNIQUE INDEX "MYSCHEMA"."A" ON "MYSCHEMA"."BNK_DEALID" ("DEAL_ID")
    PCTF
    CREATE INDEX "MYSCHEMA"."ACCENT_RAC_REPORT" ON "MYSCHEMA"."ACCENT" ("SCHEME", "VAL
    CREATE INDEX "MYSCHEMA"."ACCENT_REPORT" ON "MYSCHEMA"."ACCENT" ("SCHEME", "APP_REF
    CREATE UNIQUE INDEX "MYSCHEMA"."ACCENT_X" ON "MYSCHEMA"."ACCENT" ("DEAL_ID")
    P
    CREATE UNIQUE INDEX "MYSCHEMA"."ACCNAV_X" ON "MYSCHEMA"."ACCNAV" ("SCHEME", "ACCNA
    --How to get all the DMLs in one SQL file?
    --Nagappan, I'm using WIN.

  • How to get all data from nokia to i5s

    how to get all data from nokia E71 to i5s???

    if you can put those data in your computer then add it in iTunes. your iPhone 5s should get it thru syncing.

  • How to get all the values in one column of a JTable

    How to get all the values in one column of a JTable as a Collection of String.
    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column.

    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column. You could always write a custom TableModel that stores the data in the format you want it. It would probably be about 50 lines of code. Or you could write a loop in 3 lines of code. I'll let you decide which approach you want to take.

  • How to get ALL validate-errors while insert xml-file into xml_schema_table

    How to get all validate-errors while using insert into xml_schema when having a xml-instance with more then one error inside ?
    Hi,
    I can validate a xml-file by using isSchemaValid() - function to get the validate-status 0 or 1 .
    To get a error-output about the reason I do validate
    the xml-file against xdb-schema, by insert it into schema_table.
    When more than one validate-errors inside the xml-file,
    the exception shows me the first error only.
    How to get all errors at one time ?
    regards
    Norbert
    ... for example like this matter:
    declare
         xmldoc CLOB;
         vStatus varchar
    begin     
    -- ... create xmldoc by using DBMS_XMLGEN ...
    -- validate by using insert ( I do not need insert ;-) )      
         begin
         -- there is the xml_schema in xdb with defaultTable XML_SCHEMA_DEFAULT_TABLE     
         insert into XML_SCHEMA_DEFAULT_TABLE values (xmltype(xmldoc) ) ;
         vStatus := 'XML-Instance is valid ' ;
         exception
         when others then
         -- it's only the first error while parsing the xml-file :     
              vStatus := 'Instance is NOT valid: '||sqlerrm ;
              dbms_output.put_line( vStatus );      
         end ;
    end ;

    If I am not mistaken, the you probably could google this one while using "Steven Feuerstein Validation" or such. I know I have seen a very decent validation / error handling from Steven about this.

  • How to get all previous versions page contents of a publishing page using SharePoint Client Object Model 2010

    How to get all previous versions page contents and other field values of a publishing page using SharePoint Client Object Model 2010?
    Thanks,
    Osmita

    Hi Osmita,
    Greetings.
    Here are the links that helps you. It has code attached to it.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/a0d2ab40-99ba-4368-8505-1dc559ef6469/get-content-of-previous-version-of-page-sharepoint-2010?forum=sharepointgeneralprevious
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/faaf419f-997e-4150-9911-48cc375c3b46/how-to-get-previous-published-versions-of-publishing-pages-in-sharepoint-2010?forum=sharepointdevelopmentprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How to get all the values from a HashMap? thanks

    hi
    can anyone tell me how to get all the keys and their values contained in a HashMap? thanks

    thanks to u all for ur response, i gues if i need to get both keys and values, i need to use keySet() to get a set of keys first and then using each key to get value. is there any other faster way to get both of them (key and value)? thanks again

Maybe you are looking for

  • How to store vaults for multiple libraries on one drive

    Does anyone know if one can have a vault for three different Aperture libraries on the same external drive? The prompt says something about erasing all vaults.

  • How to create a new namespace in SOAP envelope?

    I'm trying to create SOAP envelope like the following:    <my:Envelope xmlns:my="http://my.com/">     <my:Header/>     <my:Body/>   </my:Envelope>and the following are the codes:  SOAPFactory soapFactory = SOAPFactory.newInstance();   MessageFactory

  • DW CS5 11.0.2 Update...NOT UPDATING (Windows 7)

    I noticed there is a Dreamweaver CS5 11.0.2 update available on  the Adobe download site (http://www.adobe.com/support/dreamweaver/downloads_updaters.html). I downloaded the Windows version from here: http://download.macromedia.com/pub/dreamweaver/up

  • Problem with Photoshop

    I have an old photoshop 6.0 it's ok with my old computer windows XP but, it's impossible to install on my new computer with Windows 7 64 bits. could you help me please.

  • Bluetooth on HP Pavilion dv7-2173cl Entertainment Notebook PC

    I can't seem to make this work with my Droid Razr Maxx or bluetooth wireless speaker even though there are icons in Devices and Printers dialog box with little yellow triangles on them.  Ever since I have owned this laptop, I have not been able to us