Need to detect window event for applet

I have an applet that needs to communicate with a servlet telling the servlet to logout once the parent window (web browser) is closed. I am new to programming with GUI's involved so I apologize for any ignorance. I have been searching for an answer on solving this problem for a while and have so far been able to write a simple applet that sends a message back to the servlet once the browser is closed by implementing the stop() function -- however it sends the same message when the back button is pressed. I need to message to be sent only when the browser is closed out.

Applets aside, there is no way to tell the server
when the remote user closes their browser. That’s
just one of the pits falls of web applications.
Now, in your applet, if it's possible to catch some
sort of window closing event when the browser closes
(and keep in mind I don't know if this is even
possible) then in the applets closing event you may
be able to use a URL object to post to your Servlet.That is what I was hoping to achieve -- I had defined my own stop() method which sent out a logout request to the servlet using the URL object... but it gets called every time a new page is requested. I also tried doing this in the destroy() method after reading that stop() should be called whenever a new page is requested to pause execution and that destroy() should be called when the object is reclaimed. This does not work how I expected in IE as it gets called each time a new page is requested -- must be destroyed and recreated every time.
In the URL you can pass some type of ID that uniquely
identifies your user. When the Servlet receives the
request from the applet you can parse out the ID from
the request and invalidate the users session,
essentially logging them out.I don't have to worry about a unique ID as this servlet only serves a single user at a time -- on first connection it locks the servlet and will report to other users that it is busy.
One other possible solution that I just found is the
following:
<script language="javascript">
window.onbeforeunload = function (evt) {
var message = 'Are you sure you want to leave?';
if (typeof evt == 'undefined') {
evt = window.event;
if (evt) {
evt.returnValue = message;
return message;
</script>This JavaScript function catches the window closing
event. From this function you would have to use the
JavaScript XMLHttpRequest object to send an
asynchronous request to your servlet (read up on
AJAX). Again, in the request you would need to pass
your ID to uniquely identify the user that you want
to log out.I will have to look at this -- although I want to do this in an applet that does not mean that would be the only solution that exists.
Either way it&#8217;s not going to be simple. Cheers.
-S

Similar Messages

  • Need To Return Calendar Events For Current Day

    Hello,
    I have a calendar which includes seperate start and end date fields. I need to write a query that will return events for each day in a month, but I need to be mindful of the fact that some events span multiple days. Here is my query so far which isn't working quite right.
    <cfquery name="qTodayEvents" datasource="#getDatasource()#">
    SELECT eventID, title, summary, code, description
    FROM events INNER JOIN eventTypes ON events.typeID=eventTypes.typeID
    WHERE deleted=0
    AND
      startDate >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayStartTime#" />
      AND startDate <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayEndTime#" />
    ) OR (
      endDate >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayStartTime#" />
      AND endDate <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayEndTime#" />
    ) OR (
      startDate <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayStartTime#" />
      AND endDate >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayEndTime#" />
    </cfquery>
    The query is located inside a loop which loops through the days in a given month.
    Does anyone know what I am doing wrong? Any assistance would be appreciated.
    Many thanks,
    Simon

    You have to do nested loops - one for the days of the month, and once for the query.  It probably does not matter which is nested inside of what.  You want your query ordered by EndDate.  Then you can do something like this.
    ControlDate = Date1;
    MaxDate = arraymax(yourquery["enddate"]);
    <cfloop condition = ControlDate lt Date2>
    <cfloop from = "1" to = yourquery.recordcount index = 1>
    <cfif ControlDate >= StartDate and ControlDate <= EndDate>
    your code goes here
    <cfelse>
    break
    </cfif>
    <cfloop>
    add a day to ControlDate
    maybe break if the control date is greater than the max date.
    </cfloop>

  • Best practice for detecting session expiration for applets?

    Hello,
    I'm not sure where I should have posted this question, please forgive me if this is not the place:
    http://forum.java.sun.com/thread.jspa?messageID=4105439
    I appreciate any ideas.
    Thanks.
    -Dennis

    More information:
    The code I'm using to get the response code always comes back with http status 200. The very next line:
        ObjectInputStream result = new ObjectInputStream (in);Is the one that generates the exception of EOF on stream.
    Makes perfect sense... I just wish I had a reliable way of detecting at the applet level when the session has expired...
    On the server side I get an exception as it is attempting to send the client the login form, but of course the applet is trying to send an object and the server chokes:
    Feb 16, 2006 8:35:47 AM org.apache.catalina.connector.CoyoteAdapter
    service
    SEVERE: An exception or error occurred in the container during the request processing java.lang.NullPointerException
            at
    org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:324)
            at
    org.apache.catalina.authenticator.FormAuthenticator.saveRequest(FormAuth
    enticator.java:487)
            at
    org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAut
    henticator.java:236)
            at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
    Base.java:490)
            at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541
            at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
    :126)
            at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
    :105)
            at
    org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:
    419)
            at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
    java:107)
            at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
    48)--------
    Any ideas are greatly appreciated.
    Thanks.
    -Dennis

  • Do you need to have windows 7 for bootcamp

    I have the new mac book pro.I downloaded microsoft office 2011 for mac from our educational site thus i did not have to buy any windows software. I do not have windows 7. Is there any way around having bootcamp without having to buy windows 7. Any suggestions are appreciated.

    JasonFear wrote:
    Hi hbeehan,
    If you have the just released MacBook Pro (with the Thunderbolt port) then you have to run Windows 7 if you decide to go the Boot Camp route. Apple has dropped driver support for XP/Vista with your machine -
    http://support.apple.com/kb/HT4410
    Thanks Jason, I wasn't aware of that.

  • Need HDCP-recognizing Bootcamp Windows driver for MacBook Pro's screen

    I need a Bootcamp Windows driver for my MacBook Pro 15/Retina (MBR) that recognizes that the MBR's built-in screen in HDCP-compliant.  The current Bootcamp drivers for Windows do recognized HDCP on an external HDMI-connected display, but do not recognized HDCP on the internal display.
    BTW, I've read some statements that Windows drivers don't recognize HDCP via DisplayPort connections, so I wonder if Apple is using internal wiring that acts like it's a DisplayPort connection?
    Please do not suggest things that only enable disabling DRM HDCP protection from Blu-Ray discs.  I need a solution that to cooperate with DRM HDCP protection for content from live tuners, not from a Blu-Ray or DVD disc.
    My application is using Windows Media Center (WMC) to play streaming content from my Silicon Dust HD HomeRun Prime (HDHR3) cable TV tuner on my MBR's built-in screen.  This works fine with an external HDMI-connected (HDCP-capable) display, but I also want to get this working on my laptop's screen for when I'm stuck in bed (illness, bad back, etc.).  The only application Silicon Dust offers for viewing HDHR3 tuner output on Windows (or any platform, as far as I know) which supports all protected cable channels is WMC, and WMC relies on the Apple-provided Windows NVIDIA drivers for HDCP capability.  The NVIDIA Control Panel explicitly recognizes my external HDMI-connected monitor's HDCP capability, but does not recognize the MBR's internal screen has having any HDCP.  This causes WMC to prevent the display of any TV channels at all from the HDHR3 when the only screen is the internal one (and it blocks DRM-protected channels if both screens are active in parallel).
    I'm thinking that the best solution would be an NVIDIA driver for the built-in GeForce GT 650M for Windows 8 (or 7) which recognizes HDCP capability via DisplayPort.  Is there anything like that?  Or, alternately, some add-in driver that adds a layer of HDCP capability recognition to the standard drivers?
    Is there any currently-available solution?  . . . something that will enable the internal screen to play all the tuner's cable channels including DRM-protected ones (either on Bootcamp'ed Windows or on the OS X side)?
    P.S. -- FYI, the only other potential app I've read about for using an external tuner with a MacBook is an OS X version of MythTV, but (a) that requires an excessively long list of geek tweek steps (install an SQL application, create an SQL database, do lots of command-line tweaks, add & configure a backend app and then a frontend app, ... ) and (b) even then it seems it doesn't support channels that aren't marked "copy-freely", i.e., HDCP-enabled DRM protected content.

    Strange -- sig's comment seems gone now.  I wonder why.
    Anyway, I did try the latests NVidia drivers yesterday, afterall they explicitly say they added HDCP over DisplayPort, but no joy.  In the NVidia control panel (for Windows), external displays via HDMI have a left-menu section for HDCP that explicitly shows it's working, but there is still no such indication for the internal display, and I am still unable to use WMC with HD HomeRun Prime cablecard tuner to play anything on the screen except channels that the provider marks "copy freely" (e.g., Bloomberg news channel 722 isn't playable, but MSNBC 723 is playable). 
    My guess is that maybe laptop internal displays don't explicitly have internal DisplayPort and HDCP technology but have some kind of exception that normally allows playback?
    As an alternative I wish there were cablecard tuner playback software on the OS X side that could play more than "copy freely" cablecard-tuned material, but there doesn't seem to be anything comparable to Windows Media Player that supports that.  (Now it should be clearer why this discussion belongs under MacBook Pro and not under Bootcamp where the moderators moved it.)

  • Unsol Msg conversion to Windows Event

    Has anyone written a .dll which will sit on an unsolicited message queue and convert
    the received unsolicited messages into Windows Events for processing by an application?
    I have a Powerbuilder app which needs to process unsolicited events and understand
    that this has been done somewhere.
    Rather than re-inventing the wheel, it would be nice to obtain the source so I
    can try it out.
    Win NT4 or Win2000, Powerbuilder 7.
    Any help would be greatly appreciated.
    ..Lyall

    Lyall,
    I think that the AEWsetunsol function (see AEWsetunsol(3c) ) should help you here?
    Regards,
    Peter.
    Got a Question? Ask BEA at http://askbea.bea.com
    The views expressed in this posting are solely those of the author, and BEA
    Systems, Inc. does not endorse any of these views.
    BEA Systems, Inc. is not responsible for the accuracy or completeness of the
    information provided
    and assumes no duty to correct, expand upon, delete or update any of the
    information contained in this posting.
    Lyall Pearce wrote:
    Has anyone written a .dll which will sit on an unsolicited message queue and convert
    the received unsolicited messages into Windows Events for processing by an application?
    I have a Powerbuilder app which needs to process unsolicited events and understand
    that this has been done somewhere.
    Rather than re-inventing the wheel, it would be nice to obtain the source so I
    can try it out.
    Win NT4 or Win2000, Powerbuilder 7.
    Any help would be greatly appreciated.
    ..Lyall[att1.html]

  • Creation of event for background processing

    Hi,
    I need to create a event for background job. in which the job has to be created based on variant in one user exit via sm36 and i have to trigger the same in other user exit.
    thanks in advance
    shiva

    Try using the Function module "BP_JOB_CREATE" .
    rgds
    anver

  • Utilities: events for device

    Hi all,
    i need to know the events for device installation and device installation replacement.
    please help urgent help required.
    Thanks,
    Anand.

    Hi,
    Check out the relevant event in the tcode: FQEVENTS
    the events in SAP ISU are similar to user exits in SAP R/3 in functionality...
    Hence you can search for event call in the transaction with key word: FKK_DETERMINE_<Event No in FQ events> or only with FKKdetermine....
    Regards
    Shiva

  • Utilities:Events for device installation and replacement

    Hi all,
    i need to know the events for device installation and device installation replacement.
    please help urgent help required.
    Thanks,
    Anand.

    >events for device installation
    1. An installation order for a device or a device group is created in the Service Management (PM-SMA) application component. This may result from a company requirement (such as a switching change) or an external requirement (new connection),                                             
    2. The installation order is executed and returned.                                             
    3. The removal of the device is entered in IS-U.                                             
    >device installation replacement
    1. A replacement order is created for a device or a device group in the Service Management (PM-SMA) application component. This may result from a company requirement (such as a switching change) or an external requirement (such as a change in use of the object).                                             
    2. The replacement order is executed and confirmed.                                             
    3. The replacement of the device or of all devices in a device group is entered in IS-U.
    Regards,
    Dharani

  • Urgent help needed on writing errors in to windows events application logs

    Hi all,
    we have web based application. Whenever there is critical errors encounters in our application we need to write that errors in to windows
    event viewer, application logs. Please help me on how to do this.
    do we have any specific API for this ?
    thanks in advance
    Shivakumar

    You should use WinAPI to do so. Asking in JNI forum (or specialized WinAPI forum) for more details is good idea I think.

  • Require list of all events for Windows Server 2008 Active Directory

    Hi all,
    I require list of all events for Windows Server 2008 Active Directory. Event Log name for Active Directory log is "Directory Service".
    Regards,
    SR

    Hi,
    Thanks for your posting.
    Do you mean you want to list all Active Directory logs into one file named “Directory Services”?
    If that, it’s hard to achieve. There are kinds of Active Directory logs stored in different locations and they have different file formats. It’s hard
    to collect them into one file.
    Active directory records events in the directory services log in Event Viewer. By default, Active Directory records only critical error events. To instruct Active
    Directory to record other events in the directory services log, we need to modify registry.
    For more information please refer to following MS articles:
    Active Directory Diagnostic Logging
    http://technet.microsoft.com/en-us/library/cc961809.aspx
    How to configure Active Directory diagnostic event log
    http://support.microsoft.com/kb/314980
    Lawrence
    TechNet Community Support

  • Parse Windows login event for specific details

    Hi,
    I have a windows event that I want to search for in the event log using Powershell.  I've got the basics but can't find how to drill further into the details.  This is what I have so far:
    get-eventlog security | where{$_.eventid -eq 4624 -and $_.message -match "Logon Type:\s+3"}
    The problem is in the event details I have the following:
    An account was successfully logged on.
    Subject:
        Security ID:        NULL SID
        Account Name:        -
        Account Domain:        -
        Logon ID:        0x0
    Logon Type:            3
    New Logon:
        Security ID:        test\administrator
        Account Name:        administrator
        Account Domain:        test
        Logon ID:        0x318df67
        Logon GUID:        {0b843e34-532c-e4c2-9577-2ee19684f472}
    Process Information:
        Process ID:        0x0
        Process Name:        -
    Network Information:
        Workstation Name:    
        Source Network Address:    192.168.10.11
        Source Port:        51446
    How can I query for this information, as for example there are 2 instances of Security ID....
    Thanks
    James
    Alter De Ruine

    This blog post does not fully match your request but it shows how to deal with eventlog data in powershell and using the toxml method:
    http://www.normanbauer.com/2012/01/10/how-to-get-detailed-information-on-windows-boot-and-shutdown-performance-in-powershell/
    Basically you'll need something like the following code to start with:
    #Get events in security log with id 4624
    $items = Get-WinEvent -FilterHashtable @{logname="Security"; id=4624;}
    #Get first item as xml
    $xmlitem = [xml]$items[0].ToXml()
    #Get EventID
    $xmlitem.Event.System.EventID
    #Get logging computer
    $xmlitem.Event.System.Computer
    #Get computer
    $xmlitem.Event.EventData.Data | where-object {$_.Name -eq "SubjectUserName"}
    #Get account
    $xmlitem.Event.EventData.Data | where-object {$_.Name -eq "TargetUserName"}
    #Get logon type
    $xmlitem.Event.EventData.Data | where-object {$_.Name -eq "LogonType"}
    #Get ip address
    $xmlitem.Event.EventData.Data | where-object {$_.Name -eq "IpAddress"}
    #Get all data
    $xmlitem.Event.EventData.Data
    In your example the duplicyte Security IDs resolve to - I think - SubjectUserName and TargetUserName.

  • Need to run windows on new imac with lion.  where do i get windows for mac?

    I have a new iMac and am new to Apple after 30+ years with PC-based hardware & software.  First of all, and not to offend, but anyone who says Mac computers are easier to use than Windows computers must be talking about people who just came out of the jungle and are seeing their first computer.  Sorry, I just needed to get that off my chest.  That aside, I have legacy software that I need to run on the Mac (actually, one of the programs is CALLED Legacy).  I'm told that if I want to use Bootcamp or Parallels software I need to install Windows on the Mac.  Is that a special kind of Windows made for Mac, or will just any old Windows do?  I've checked Bing and Google but they're so "ad-crazed" that I couldn't find anything. 
    I'm sure that, after 30 more years, I'll probably have the Mac OS down and find Windows 21 (or whatever they'll call it) to be difficult to use. . 

    Nope. Any flavor should work including both 32- and 64-bit versions. See these for more:
    Boot Camp - Installation & Setup Guide (OS X Lion)
    Boot Camp 4.0 System Requirements
    Boot Camp 4.0, OS X Lion: Frequently asked questions
    Boot Camp Support
    Boot Camp: Windows 7 installation frequently asked questions
    About Boot Camp and Windows 7

  • Windows needs to install driver software for your unknown device

    Windows needs to install driver software for your unknown device
    This is the message that i get when ever i plug in my ipod touch to my computer. the computer is running on vista. i dont know what to do, because i tried to follow the steps suggested, but it didnt work, the computer said that it couldnt find anything and to check with apple for some driver software. HELP!!!

    The iPod touch and iPhone do not use the same type of USB drivers that other Apple devices use. They both require Apple Mobile Device Services to be running. Using this tech article as a guide, you can easily fix this: http://support.apple.com/kb/TS1567

  • In need of a pushbutton event handler for a cl_gui_custom_container

    Greetings Experts:
    Here is the situation...
    I have two cl_gui_custom_containers. Container1 has a double click event reciever that when fired displays longtext using the READ_TEXT function module displaying in Container2.  I am trying to add a pushbutton to Container2 to print contents of the screen (but not the Container1 ALV).
    It seems I am in a bit of a stand still and am in need of some advice.
    Thanks in advance.
    - Dan -

    Here is a little example program, it is not a 100% solution, but you should be able to get the idea here.  It is implemented into a docking container, so that this example is a cut/paste example.  Here we are splitting the docking container into two parts, buttom is the text editor, the top is our toolbar, notice the only button there is Print,  if you click this this will fire an event and will write out what you have typed into the text editor control.
    report zrich_0001.
    type-pools: icon.
    data:
          dock_sub_cont1   type ref to cl_gui_container,
          dock_sub_cont2   type ref to cl_gui_container,
          splitter         type ref to cl_gui_splitter_container,
          dockingleft      type ref to cl_gui_docking_container,
          text_editor      type ref to cl_gui_textedit,
          gui_tb           type ref to cl_gui_toolbar,
          repid type syrepid.
    data: itext type table of tline-tdline,
          xtext type tline-tdline.
    *       CLASS lcl_event_handler DEFINITION
    class lcl_event_handler definition.
      public section.
        class-methods:
        handle_pushbutton_click
                   for event function_selected
                           of cl_gui_toolbar importing fcode.
    endclass.
    *       CLASS lcl_event_handler IMPLEMENTATION
    class lcl_event_handler implementation.
      method  handle_pushbutton_click.
        case fcode.
          when 'PRINT'.
            call method text_editor->get_text_as_r3table
               importing
                     table              = itext
               exceptions
                     others             = 1.
            leave to list-processing.
            loop at itext into xtext.
              write:/ xtext.
            endloop.
        endcase.
      endmethod.
    endclass.
    parameters: p_check.
    at selection-screen output.
      repid = sy-repid.
      check dockingleft is initial.
      create object dockingleft
                  exporting repid     = repid
                            dynnr     = sy-dynnr
                            side      = dockingleft->dock_at_left
                            extension = 1070.
      create object splitter
                            exporting parent = dockingleft
                                      rows    = 2
                                      columns = 1.
      call method:
                      splitter->get_container
                        exporting row            = 1
                                  column         = 1
                                  receiving container = dock_sub_cont1,
                      splitter->set_row_height
                        exporting id             = 1
                                  height         = '3',
                      splitter->get_container
                        exporting row            = 2
                                  column         = 1
                                  receiving container = dock_sub_cont2.
      perform create_toolbar.
      create object text_editor
                  exporting
                       parent     = dock_sub_cont2.
      set handler:
                   lcl_event_handler=>handle_pushbutton_click for gui_tb.
    start-of-selection.
    *       FORM create_toolbar                                           *
    form create_toolbar.
      data: event type cntl_simple_event,
           events type cntl_simple_events.
    * Create the toolbar object
      create object gui_tb
        exporting
          parent             = dock_sub_cont1
        exceptions
          cntl_install_error = 1
          cntl_error         = 2
          cntb_wrong_version = 3
          others             = 4.
    * Set up events  for toolbar
      clear event. refresh events.
      event-appl_event = 'X'.
      event-eventid = gui_tb->m_id_function_selected.
      append event to events.
    * Register the events
      call method gui_tb->set_registered_events
        exporting
          events = events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    * Add Buttons to toolbar
      call method gui_tb->add_button
        exporting
          fcode            = 'PRINT'
          icon             = icon_print
          butn_type        = '0'
          text             = '  Print'
        exceptions
          cntl_error       = 1
          cntb_btype_error = 2
          cntb_error_fcode = 3
          others           = 4.
    endform.
    Regards,
    RIch Heilman

Maybe you are looking for

  • File Association Problems with PDF

    I have installed the trial version of Acrobat, and have been using a free reader called FoxIt. My problem is that adobe keeps stealing the file associations from FoxIt. If I set FoxIt to be the default for PDF files, after reboot, or any other adobe

  • Screen flickers imac

    The screen of my imac flickers, for the last three months. No further problems. Anyone idea to reolve this problem? Thanks!

  • Report on materials posted in Quality Inspection

    Good day! Is there an available report or list display for materials that were received and posted to quality inspection? Thanks!

  • Using 'exp' from Oracle 8i Lite

    I want to dump an Oracle 8i Lite database to a binary dump file so that I may import it into a Oracle 8i production database. Can I do this using the exp80.exe program in the \ORAWIN95\BIN directory? If so, what is the correct command line to carry o

  • Mapping Routing service with a database adapter in ESB

    Hi, I have a database adapter configured for a Stored procedure that takes in a XML_TYPE and returns a CLOB. I also have the Schema for request and response, which I have configured in a Routing Service. Now how do I map the Routing Service to the Da