Using Callback handelr to get Username

For my JSF project I have a httpSessionListener which works fine on session Timeout.
In the sessionDestroyed() method I have to get the User name of the user that was timed out.
I have to use Call back handler for that. The problem is that i am always getting the username as null and also the callback handler is null.
My listener class is as follows :
public class myHttpSessionListener  extends DBTableOraDataSourceLoginModule implements HttpSessionListener
// callback handler settings
  static final int NUM_CALLBACKS = 2;
  static final int USERNAME_CALLBACK_INDEX = 0;
  static final int PASSWORD_CALLBACK_INDEX = 1;
  String username = null; protected CallbackHandler callbackHandler = super._callbackHandler;
public void sessionDestroyed(HttpSessionEvent sessionEvent)
// Get the session that was invalidated
HttpSession session = sessionEvent.getSession();
if (callbackHandler == null)
Utility.logMessage(Constants.SEVERITY_INFO,
"******* CallBack Handler is NULL ********", this);
Callback[] callbacks = new Callback[NUM_CALLBACKS];
callbacks[USERNAME_CALLBACK_INDEX] = new NameCallback("Username");
callbacks[PASSWORD_CALLBACK_INDEX] = new PasswordCallback("Password:",false);
try
callbackHandler.handle(callbacks);
username =
((NameCallback) callbacks[USERNAME_CALLBACK_INDEX]).getName();
catch (UnsupportedCallbackException e)
Utility.logMessage(Constants.SEVERITY_INFO,
"^^^^^^^^^ UnsupportedCallbackException() ********" + e , this);
catch (IOException ie)
Utility.logMessage(Constants.SEVERITY_INFO,
"^^^^^^^^^ IOException() ********" + ie , this);
Utility.logMessage(Constants.SEVERITY_INFO,
"SessionDestroyed() ******** UserName = " + username , this);
}Thanks in advance .....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

In java we have one method of System class to get the properties of system.
System.getProperty(String propName)
To get the user name , we can use the property name : user.name
System.getProperty("user.name")
which returns the current working user name of the system..
try it out.
Regards

Similar Messages

  • In iPhoto, when i try to email a photo using "share", I keep getting"username/password" not recognized. It used to work automatically before.

    I cannot email  a photo using iPhoto "share. I keep getting "username/password not recognized". I used to use this function all the time but all of a sudden, I keep getting this message.

    In iPhoto, open Preferences (under iPhoto in the menu bar) and click the "Accounts" tab on top.  Make sure your email account(s) is/are set up there correctly, just as they are in Apple's Mail.  Make sure the password in included.

  • Performance of AQ when using callback procedure (using PL/SQL notification)

    I am enqueueing XMLType in AQ.XML file is large in size.NOw I want to dequeue the AQ using PL/SQL notification(using callback procedure which will call DBMS_AQ.DEQUEUE to dequeue the AQ and process the XML.After fetching the data from XML ,I want to store these data in another table columns).
    Please suggest,In this case which approach would be better to dequeue the AQ table :
    1.PL/SQL notification(using callback procedure)
    OR
    2.Scheduling the call to DBMS_AQ.DEQUEUE to dequeue the AQ table
    What would be the impact on performance of above two approaches?

    Hi,
    The question of performance is not down to the technique one employes to enqueue/dequeue, but at a basic level, is relative to the number of messages!
    The is what the Oracle documentation states:
    >
    When persistent messages are enqueued, they are stored in database tables. The performance characteristics of queue operations on persistent messages are similar to underlying database operations. The code path of an enqueue operation is comparable to SELECT and INSERT into a multicolumn queue table with three index-organized tables. The code path of a dequeue operation is comparable to SELECT, DELETE, and UPDATE operations on similar tables.
    >
    So, if anything, the dequeue is a fraction more time & resource consuming. However, it is only a "fraction". You could always add multiple subscribers to dequeue if you want!
    You could ofcourse choose to have non-persistent messages if your application does not need the kind of fault-tolerance that persistent messaging offers, which speed things up, but only a bit, so don't get too excited about it!
    There are other things to consider however, which you may wish to read up on before getting bogged down on whether you should use notification or the scheduler:
    - Is your system clustered?
    - Concurrency on a single queue (i.e. multiple enqueues/dequeues, but single queue)
    - Propogation latency issues
    Read about these and much more at:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14257/perform.htm
    Finally, whether you pl/sql notification or not and whether you use dbms_scheduler is down to your application requirements!
    P;

  • How can I use QuickTime SDK to get Compress format of Video stream?

    I can get uncompress video stream like this:
    QDerr = NewGWorldFromPtr( &m_hGWorld, k32BGRAPixelFormat, &rcMac,
    NULL, NULL, 0, (char*)m_pVideoBuffer,
    m_sAVFileInfo.sResInfo.ulWidth*4);
    then the m_pVideoBuffer is uncompress video stream. How can I use QuickTime SDK to get Compress format of Video stream? I could change "k32BGRAPixelFormat" to other format,use other API or something?
    Could someone have the method? Best Wishes!

    Firefox, I would make sure you update your Desktop to Firefox 14.0.1, as the version you are running is quite old and out of date.
    Then, do you have your Sync Recovery key, username and password? If you do, you can re-add Firefox Sync to your computer.

  • WS-security Need to Get Username and Password and time Stamp in SOAP Header

    HI ALL,
    i need to get USERNAME and PWD in my Soap header for consuming Webservice using SAP PI ,
    and my SOAP Header should look like this
    <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurityutility-
    1.0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-
    secext-1.0.xsd">
    <wsu:Timestamp wsu:Id="Timestamp-296915943">
    <wsu:Created>2008-06-05T18:30:59.904Z</wsu:Created>
    <wsu:Expires>2009-06-05T18:35:59.904Z</wsu:Expires>
    </wsu:Timestamp>
    <wsse:UsernameToken wsu:Id="UsernameToken-192809888">
    <wsse:Username>midtier-service</wsse:Username>
    xxxxxxxx: Confidential Green 10
    <wsse:Password Type="http://docs.oasisopen.
    org/wss/2004/01/oasis-200401-wss-username-token-profile-
    1.0#PasswordText">password</wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>
    </soapenv:Header>
    should i need to get some certificates from client and deploy it or should we do anything in SAP PI and send to soap header or can hard code it and send to webservice, please help me in this t
    hanking you
    Sridhar

    i need to get USERNAME and PWD in my Soap header for consuming Webservice using SAP PI ,
    Can be achieved by XSL Mapping or SOAP Axis Adapter. Search on SDN for further details as this has been discussed many a times on the forum.
    should i need to get some certificates from client and deploy it or should we do anything in SAP PI and send to soap header or can hard code it and send to webservice, please help me in this t
    First you need to confirm whether certificates are required or not. Might be the web service is using user id / password security (basic authorization).
    How to use certificates in PI - Search on SAP Help, this has been explained in great details over there.

  • How to get username from customer email id.

    Hi experts,
    How to get username from customer email id.I am using transaction XD02.
    I would be thankful for your kind replies .
    Regards,
    Sachin Hada

    Hi sachin,
    Re: Email id field
    Regards,
    Sravanthi

  • Advanced queueing: How to detect disconnect/database down if using callback

    In my last thread here, I was able to create a callback mechanism for fetching messages posted to the AQ-queue. This means I can get rid of the loop that polls for messages, that we had earlier.
    In the loop I could detect network problems, because the Dequeue function would throw an exception. When I have a callback, no exception is thrown, since I do not try to dequeue before I know there is a message there.
    How can I handle detection of network problems/database problems when using callback? If not handled, the program thinks no mesages is sent, while actually the network might be down...
    I'm not to keen on looping and polling to check for network status, as the whole point of callback was to avoid this :)
    Regards,
    Sverre

    update: I've tried to use both the OCI and OCCI failover callback, but it is not called when e.g. the network cable is disconnected.
    Is there any way to get occi to notify me when there is something wrong with the connection? Right now my callback is never called again, if the network is disconnected and reconnected...
    Anyone?

  • Get Username

    How to get username from Client Machine in java
    More Specific
    My Jsp Files in a Server .when Client Acces Jsp Page his username should be displayed.(username:- System Username while loggging in)

    request.getRemoteUser() returns the user ID that was used to authenticate the user to your web server. If you were expecting to get the user name that I used to sign on to my computer when I come to your web server, no.

  • Is iCloud username and pass the same as my apple ID and pass? I keep getting username or password incorrect for Icloud

    Is my iCloud username and password the same as my apple id and pass?  I keep getting username or password incorrect when trying to use I loud email

    The password is the same, the mail address has to be an iCloud address (Mac, Me or iCloud) which may or may not be the same as the address you use to log into iCloud.

  • Get username via servlet from Tomcat session

    I have a servlet that uploads files. In order to distinguish files, I want to put the username,date, and time in the new filename (I already have the date and time). Can somebody point me to an example that will get the username from the tomcat session?
    thanks in advance,
    Chuk

    Assuming that the user has logged in to your web application through something like form-based authentication you can use:
    request.getUserPrincipal()to get hold of information about the user.
    However, if they've not logged in with your site then you'll get nothing back. Also, depending on the version of Tomcat you've got you may encounter some stupid behaviour (getting null back) if the Servlet isn't a protected resource.
    Failing that you can try getRemoteUser to try to obtain some information about the authenticated user; I've had some problems with this in the past with IIS and haven't tried it with Tomcat.
    If you want more information about how to get your user to authenticate against your web application realm then just ask...
    Hope this helps.

  • TS4268 I have apple ID and when trying to sign in to use FaceTime,i always get registration error.how may you help me for that guys,thanks.

    I have apple ID and when trying to sign in to use FaceTime,I always get error in registration,(This words always apper; The server encountered an error processing registration.Please try again later.)
    Can I get your Advise on what to do? Thanks

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • How do I use Display Dialog to get back a date?

    Can anyone tell me how to use Display Dialog to get back a date?
    I am using the following code that does not work. It does not accept anything.  And I have searched high and low for an answer to my question and found nothing.
    repeat
           display dialog "When should I remind you (date)?" default answer ""
           try
                 if the text returned of the result is not "" then
                        set the requested_text to the date returned of the result as date
                        exit repeat
                end if
           on error
               beep
    end try
    endrepeat
    display dialog requested_text
    The code is based on what I found in AppleScript 1-2-3 (page 300). It shows examples for getting text and numbers but not one for dates.
    For what it is worth, my goal is to create a script that will convert an email from Evernote into an iCal Reminder. To do so, I want to ask the user (myself) for the reminder's date and time. I am assuming I need to ask for each separately. I also assume that once I get the date and time for the reminder, it should be relatively straightforward to 'make' a 'todo' with an alarm.
    Thanks in advance.
    -David

    Hi David,
    Try this:
    repeat
        set theCurrentDate to current date
        display dialog "When should I remind you (date)?" default answer (date string of theCurrentDate & space & time string of theCurrentDate)
        set theText to text returned of result
        try
            if theText is not "" then
                set theDate to date theText -- a date object
                exit repeat
            end if
        on error
            beep
        end try
    end repeat
    display dialog (date string of theDate & space & time string of theDate)
    You might also have a look at this page of the AppleScript Language Guide.
    Message was edited by: Pierre L.

  • Is there inbuild Handler in weblogic using which i can get the MessageContext object

    HI,
    I need MessageContext object in my application but i dont want to use the Handler,As
    there is AxisEngine in axis soap engine,is there any similar implementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContext what about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

    HI,
    yeah i had to make use of Handler to get the MessageContext object and play with
    that.
    Thanks & Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can get to MessageContext from a handler. Check out an example of
    handler
    to see how you can get Message out of MessageContext.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI manoj,
    Thanks for your reply.otherwise i thought that i wont get any morehelp
    on this
    forum :-) ...
    anyway its good that we will have such thing in next version,duringthe
    development
    i feel that more functioanlity should be in build in appserver. Likeone
    more
    thing i could not find out is how we can get the "message" object inweblogic
    like we can in axis using its MessageContext class's static method.if it
    is there
    can you please let me knwo about that.
    The other problem i had to make use of handler and my appl is workingas of
    now :-)
    Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can not do this in WLS 7.0. The next major release (WLS 8.1) will
    fix
    this problem.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI,
    I need MessageContext object in my application but i dont want
    to
    use
    the Handler,As
    there is AxisEngine in axis soap engine,is there any similarimplementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContextwhat
    about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

  • I have a 60 inch Sony XBR TV that has DVI input but not HDMI. I am using an adapter to get the video from my Apple TV, but the screen flashes a lot. Do I have any other choices other than buying a new TV?

    I have a 60 inch Sony XBR TV that has DVI input but not HDMI. I am using an adapter to get the video from my Apple TV to the Sony, but the screen flashes a lot. Do I have any other choices other than buying a new TV?

    Is this an iphone question?
    You have posted in the iphone forum.

  • Can I use an adapter to get thunderbolt on my early 09 MacBook pro

    Can I use an adapter to get thunderbolt on my early 09 MacBook pro?

    No.  ThunderBolt is a direct connection to your systems PCI Express bus.  There is no way for your existing ports to do this with any sort of external adapter.

Maybe you are looking for