Cancel download method when the user cancel the download file

I have a method that download a file ("downloadLog_action()")when the user click over the comandlink component and the dialog box is opening to save the file, but how to know that the user canceled the download file to cancel all accions.
This is the code of the commandlink in the jspx page that call the method and pass one parameter:
<af:commandLink binding="#{ConsultaValidacion.commandLink1}"
id="commandLink1"
action="#{ConsultaValidacion.descargarLog_action}"
text="Log">
<f:param name="codInstitucion"
value="#{row.CodInstitucion}"
binding="#{ConsultaValidacion.codInstitucion}"
id="codInstitucion"/>
</af:commandLink>
This is the method to download the file:
HttpServletResponse response = (HttpServletResponse)fctx.getExternalContext().getResponse();
response.setContentType("application/x-download");
response.setHeader("Content-Disposition", "attachement; filename=\"Log_" +
codigoInstitucion + ".txt\"");
response.setContentLength((new Long(blob.getLength())).intValue());
//Streams de entrada y salida
InputStream is;
OutputStream out;
try {
//Obtenemos el stream de entrada el cual se lo extrae de la BD
is = blob.getInputStream();
//Obtenemos el stream de salida para el cliente
out = response.getOutputStream();
//Sección de código que me permite escribir los datos en el stream de salida
int size = (new Long(blob.getLength())).intValue();
byte[] buffer = new byte[size];
int length = -1;
while ((length = is.read(buffer)) != -1) {
out.write(buffer, 0, length);
//Cerramos los streams
out.flush();
is.close();
out.close();
*//Una vez descargado todo el LOG actualizamos el contador. HERE IS THE PROBLEM BECAUSE THE COUNTER IS UPDATING WHEN THE USER CANCEL THE DOWNLOAD!!! AND ITS WRONG*
row.setNumDescargaLog(new Number(num + 1));
//Guardamos los cambios
webRvc.getAppModuleWebRvc().getDBTransaction().commit();
//Request lifecyce understands that the response is completed and no further action needs to happen
fctx.responseComplete();
} catch (IOException e) {
e.printStackTrace();
webRvc.close("Consulta bitacoras validacion");
return null;
} catch (JboException ex) {
webRvc.getAppModuleWebRvc().getDBTransaction().rollback();
webRvc.close("Consulta bitacoras validacion");
return null;
This works fine.
The problem occurs when the user cancels the download, because all the sentences run including updating the counter downloads, the counter only to be updated only when the user chooses to save the file.

Hi.
The problem is when the user cancel the dowload I do not know how to capture the user's response.
How to capture the response?
if(cancelled) <------Is there a parameter to tell me this?
......<your cancel code>..... none
else
.....<your non-cancel code>...THE METHOD THAT DOWNLOAD THE FILE - "downloadLog_action()" and increment the counter
Thanks.

Similar Messages

  • How to remove save, cancel option when end user runs the workbook in Portal

    Hi,
    how to remove save, cancel option when end user runs the workbook and make some small changes like using page items or increasing rows and columns
    I already made 2 changes
    1) I removed the option in Oracle Enterprise Manager under discoverer viewer of saving
    2) I also removed the option of Allow saving changes made in Viewer when adding workbook to portal
    But still the end user gets options of saving when made small changes to workbook like increasing rows and columns
    Is their any place, I need to make changes?
    Thanks in Advance
    Rowdheer

    Don't use JSP to serve a binary file. It almost implies the use of awful scriptlets and the invocation of both the response writer and the response outputstream which would only lead to IllegalStateException headaches in the server logs.
    Use a Servlet instead. Specify the file name as request parameter and let the servlet read the file and write it to the outputstream of the response.

  • How do i cancel my subscription when i go to the page on adobe it just goes back to the previous page. is there an email address i can contact the customer support?

    how do i cancel my subscription when i go to the page on adobe it just goes back to the previous page. is there an email address i can contact the customer support?

    I don’t know the email address, but this page might help:
    Cancel your membership or subscription | Acrobat.com online services

  • Customer Service just cancelled my chat when I asked for the # to call to cancel. Can i get that #?

    Customer Service just cancelled my chat when I asked for the # to call to cancel service. Can I get that #? We want to get new phones and Verizon will not offer any kind of deal.

    *611 or 1-800-922-0204 and cancel. However if you cancel on the phone you lose your cell numbers.
    If you just go to the carrier of choice, you port out and keep your cell numbers.
    Good Luck

  • When the user Clicks the Modify button remaining Buttons should be dispayed

    Hi experts,
                         In my application  I have 3 fields and three buttons(Modify ,save and cancel)...The 3rd field is DATE field ...i have to display only MODIFY..and the remaining 2 buttons should be disable mode at Runtime.
    1) when the user clicks the MODIFY button....then only other two buttons should be visible in my current application.
    2) when the user clicks the SAVE button....the 3rd field should displayed with current date or System date.
    3)whenever the user modify the details using modify button...meanwhile if the user clicks the cancel button...all three fields goes to Read only mode...
    Thanks In advance for all.
    how can i write the logic for all these 3 requirements...can anybody plz help me...
    Regards,
    Praveena..
    Edited by: s.praveena on Jun 14, 2010 7:36 PM
    Edited by: s.praveena on Jun 14, 2010 7:39 PM
    Edited by: s.praveena on Jun 14, 2010 8:01 PM

    Basically you want to handl the visibility and read-only properties of the UI elements at runtime.
    To handle visibility property create a context attribute of type WDUI_VISIBILITY and bind it with the UI element's visible property.
    in MODIFY action handler set this context attribute to IF_WDL_CORE=>VISIBILITY_VISIBLE to make it visible
                                                                                    IF_WDL_CORE=>VISIBILITY_NONE to make it invisible.
    Similarly to handle the read-only behaviour, create the context attribute of type WDY_BOOLEAN and bind it with the readonly property of the UI element.
    and in action handler assign a value to the context attribute. ABAP_TRUE to make it readonly
                                                                                    ABAP_FALSE to make it editable.

  • Avoid the deletion of delivery when the user press the delete button

    Hi guys,
    In VL02N transaction, when the user press the button for delete the delivery (trash button) i have to send an idoc to an external system in order to inform about. Im using IF_EX_LE_SHP_DELIVERY_PROC~DELIVERY_DELETION for this and it works fine.
    After send the idoc i have to stop the deletion process. So How i can avoid the delivery deletion? I can change some flag in this BADI or maybe i can do something in userexit_delete_document? I dont find the way.
    Thank you,
    Manel

    HI,
    In the method SAVE_DOCUMENT_PREPARE; try to pass some error messages in the parameter CT_LOG.
    This should raise some messages before saving and the data will not be saved and hence delivery will not be deleted.
    Check the same.
    Regards,
    Ankur Parab

  • I need help installing my adobe premiere element 13. the soft ware is 3.5 GB and I have a 654.4GB space is this enought space to dowload the software. It appears the software is downloading , but when it gets to the end it gives me the error summary messa

    I need help installing my adobe premiere element 13. the soft ware is 3.5 GB and I have a 654.4GB space is this enought space to dowload the software. It appears the software is downloading , but when it gets to the end it gives me the error summary message. I have been on the phone for hours being transfered from from person to the next with no results.

    reesep
    This is not Adobe. Rather user to user. The Adobe Staff and PRE_help presence in this forum is undefined.
    The replies from here are not instantaneous. But, your fellow users all try to respond as timely as possible.
    What is your computer operating system?
    From where are you downloading Premiere Elements 13....direct from Adobe as the tryout or the purchased product? If the purchased product, do you now have a purchased serial number to go with the installation files?
    Where are you stopped in the installation....at the Sign In or before? Is the faulting module cited in any messages? What are the error messages?
    The usual questions:
    1. Are you working with the antivirus and firewall(s) disabled?
    2. Are you running the computer programs as administrator?
    3. Are you working with a pen and tablet device instead of mouse?
    4. Is your video card/graphics card up to date according to the web site of the manufacturer of the card?
    5. Are you installing the program to the default location on the Local Disc C (if Windows).
    Let us start here and then decide what next based on the details that you post. Subsequent troubleshooting may include:
    deletion of the Adobe Premiere Elements Prefs file and/or uninstall, free ccleaner run through, reinstall with antivirus and firewall(s) disabled.
    Any questions or need clarification, please do not hesitate to ask.
    Thank you.
    ATR

  • What happens when multiple users access the same servlet?

    Do the users share all the same resources? Or is a new process generated for each user? I have a servlet that builds a string to return to the user and I only have myself to test, so I can't really see what happens when many users access the servlet. Is there a possibility that the string will get screwed up, like when dealing with multiple threads, or do all the users get their own resources and I don't have to worry about that?

    huh? if you can point a test servlet at it, you can point a browser at it (even if the servlet does not serve html it will run)
    try pasting the servlet URL into a web browser
    refreshing multiple browsers repeatedly could provide a manual test

  • When the user press the button Calculate Tax (see attached doc) and click on Tax details then this should be updated automatically. But it does not work it is empty and the user has to update manually.

    When the user press the button Calculate Tax  and click on Tax details then this should be updated automatically. But it does not work it is empty and the user has to update manually.
    All setup looks fine.
    Please let me know what can be done on this?
    Regards,
    Peu

    HarryAustralia wrote:
    I recently updated my ipad wifi only to the new ios 6.1.2 and initially I had the auto cover lock option which can be seen in the Generals tab, but then it stoped working!! Before the update, the auto cover lock worked fine. So after trying all the options, I then did a complete reset on the ipad and now its gone all together from the General tab!! I can no longer see the "auto cover lock" option.
    The iPad cover lock is for when you use a cover with magnets in it to lock and unlock the iPad when you close the cover or open it. Try running a refrigerator magnet along the sides of the iPad and see if that trips the iPad Cover Lock back into the settings.
    That is not the same thing as the iPad Auto Lock setting which allows you to set an allotted time before the iPad goes to sleep.
    You can try resetting all settings to see if the Auto Lock feature retinrs to the iPad.
    Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. This can be a little time consuming re-entering all of the device settings again.

  • "File Dialog" Express VI returns the wrong path when the user selects the desktop

    In labview 8.0.1 with Windows
    XP, the File Dialog Express VI seems to return something other than the path
    selected by the user when configured to browse for folders (or files and
    folders) and the user selects the desktop.
    I can't determine exactly when it works and when it fails, but it always seems
    to fail if the user selects the desktop from the places bar (the shortcuts on
    the left side of the dialog) or from the drop-down menu at the top of the
    dialog and then clicks the "Current Folder" button to dismiss the
    dialog.  In this case it always returns whatever path is wired to the
    "Start Path" terminal.
    If the user navigates to the desktop with the "Up One Level" button
    or by selecting the actual desktop directory under Documents and Settings, the
    correct path is returned.
    If the user selects a file before clicking the desktop icon, then clicks
    "Current Folder" the correct path is returned.
    If the user clicks the desktop icon, clicks open, then clicks "Current
    Folder" the correct path is returned.
    It's possible to work around this bug in most cases by setting the start path
    to the desktop.
    Has anyone seen this behavior before?
    Can anybody verify this behavior by running the attached VI?
    In the past, when I've reported issues like this I've received responses from
    NI engineers that basically said "Thanks, but we already knew
    that".  Is there anywhere that users can search the list of known
    bugs and avoid wasting time tracking down issues that are already understood by
    NI?
    Thanks,
    Adam Brewster
    Attachments:
    File Dialog Test.vi ‏39 KB

    I'm on 8.2 and I can't get it to fail no matter how I select the desktop. I haven't tried it in 8.0, but I imagine that if this really is a bug, they did know about it and fixed it with 8.2. If this causes a real problem for you, I would suggest upgrading if you can.

  • How to make a text field required at run time when the user clicks the checkbox ?

    I got a form where , there are several checkboxes and text fields associated with that checkboxes.If the use clicks on the check box then the associated
    text fields should become required.I have tried the change event and the click event for the checkboxes.It gives error in the onChnage event and I got some weird results in the on click event .Sometimes if the user click the check box , then for the 1st time the field doesnt become required , then the user onclicks the check box and when the user clicks the checkbox for the second time the field becomes required,but if i deselects the highlighted field option and selects it again the field becomes required even if the user onchecks it I am totally confused !!! Adding to it i have also written the wrong code still i achieved the desired result ?? How it can be possible . I am writing the codes below , please help me as i am working under a deadline from the client.
    onChange event :
    var newVal = this.boundItem(xfa.event.newText);
    if(newVal == 0)
        xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.Purchasecost3_1" ).validate.nullTest = "disabled";
      else
         xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.Purchasecost3_1" ).validate.nullTest = "error";
    For the onClick event :
    var a = xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row2.CostItemRecovere d_OnlyEnergyCharges").rawValue;
    //app.alert(a);
    if(a == 0)
        xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").validate.nullTest = "error";
      if(a == 1)
          xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").validate.nullTest = "disabled";
       Please help someone !!!

    I used the onchange event and wrote the code for it. I got the result . But there is a problem.All these fields are in a table and it's a dynamic table where you can add rows dynamically at the run time .I have other change event for some fields in this table .All are working fine when i add the row.But for this check box the required fields are not validated as required at the run time . I am here giving the code , Please help me .
    form1.Subform0.Subform1.Subform9.Subform10.Table48.Row2.CostItemRecovered_OnlyEnergyCharge s::change - (JavaScript, client)
    if(this.rawValue == "1")
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L2_1").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L1_2").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L2_2").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L1_3").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L2_3").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L1_4").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L2_4").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L1_5").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L2_5").mandatory= "error";
    else
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").mandator = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L2_1").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L1_2").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L2_2").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L1_3").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L2_3").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L1_4").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L2_4").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L1_5").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L2_5").mandatory = "disabled";

  • Since downloading Firefox when I go on the Internet Internet Explorer pops up with a message - IE cannot open the webpage - Favorit. I have tried everything but cannot stop this happening. Any suggestions? Thanks. I am running Vista.

    Since downloading Firefox when I go on the Internet Internet Explorer pops up with a message - IE cannot open the webpage - Favorit. I have tried everything but cannot stop this happening. Any suggestions? Thanks. I am running Vista.

    The exact same things happend to me!! how frustrating! ive reinstalld it soooo many times and quicktime seperatly too as i have had so many different error messages including something to do with quicktime, i dont know what to do but as you said my ipod is useless with out itunes! if anyone works this out let us know! thanks alot x

  • I downloaded a free music downloader and when I got my music downloaded can I transfer them to my original music app in the home music app that origanally plays music

    I downloaded a free music downloader and when I got my music downloaded can I transfer them to my original music app in the home music app that origanally plays music

    Import the songs into iTunes, then sync with your i-device.

  • How can flex tell if  it's a mouseup event when the user releases the mouse button outside the flex application?

    how can flex tell if it's a mouseup event when the user
    releases the mouse button outside the flex application? Say for
    instance mousedown was done within a 500x500 embedded flex app but
    mouseup is outside or relased on the HTML background. One more
    thing, when we have something draggable, Flex doesn't execute the
    stopDrag() when the user releases the mouse button outside the
    embedded swf or fles app. Pls. help me with this. Thanks!

    I don't think the flex app can tell what happens outside the
    app. But it can detect when it leaves the app, so I have found the
    following line works fine inside initApp():
    this.stage.addEventListener(Event.MOUSE_LEAVE, yourFunction);
    and you have to:
    import flash.display.Stage;
    Doug

  • Add code behind functionality that run when the user view the SP 2013 content pages

    I need to add code behind functionality that run when the user view the SP 2013 content pages, What is the best approach to do that?
    is it add Delegate Control to master page?
    is it add code behind to master page?
    is there an event reviver for that?
    Your answer will be highly appreciated

    Hi,
    According to me, for code behind stuff
    Create master page(using module etc..), have the required placeholders in it.
    Then, create a page that inherit from this master page, now you can use that placeholder in you page.
    Lastly, place web parts in that placeholder. So, code behind will come with that master page .
    Hope it helps.
    Thanks
    -Rahul

Maybe you are looking for

  • New MacBook Pro and 30" display - resolution wrong

    Just got new MBP with Snow Leopard. Had 30" Cinema Display connected to old mbp with dual DVI (at least, I think that's what it is - I'm not connector/adapter literate). Since there was no port for the multi-pin part of the adapter I called Apple sup

  • Copying to External Drive

    Hi I've searched and cannot find my problem elsewhere. When I try to copy a large folder of photo's to an external drive, it copies a couple of subfolders, then comes up with an error message saying it cannot continue, a folder with name XXXXX alread

  • Disabling onboard sound on K8T Neo?

    Hello, I'm probably being really stupid here but I just can't seem to find the BIOS setting to disable the onboard sound. Can't find it on any of the BIOS pages, can't find it in the manual and there doesn't seem to be a dipswitch on the board itself

  • Help me :chinese character display between JDK1.3 and JDK1.4

    My Application was builded in jdk1.3 under jb6,but when I switch my project's properties/paths/JDK to jdk1.4( the newest one),then rebuilder it,It can't display "chinese String" normally, why? Thanks!

  • Cancel upgrades

    How do I cancel an upgrade and go back to an older version of itunes?