Posted this query several times but no reply. Please help me out

Hi all,
How to know whether a servlet had completely sent its response to the request.
The problem what i am facing is, I send response to a client's request as a file.
The byte by byte transfer happens, now if the client interrupts or cancels the operation, the response is not completed.
At this stage how to know the response status. I am handling all exception, even then I am unable to trap the status.
Please help me out.
I have posted this query several times but no convincing reply till now. Hence please help me out.
If somebody wants to see the code. I'll send it through mail.
regards
venkat

Hi,
thanks for the reply,
Please check the code what I have written. The servlet if I execute in Javawebserver2.0 I could trap the exception. If the same servlet is running in weblogic 6.0 I am unable to get the exception.
Please note that I have maintained counter and all necessary exception handling even then unable to trap the exception.
//code//
import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.security.*;
public class TestServ extends HttpServlet
Exception exception;
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException, UnavailableException
     int bytesRead=0;
     int count=0;
     byte[] buff=new byte[1];
OutputStream out=res.getOutputStream ();
res.setContentType( "application/pdf"); // MIME type for pdf doc
String fileURL ="http://localhost:7001/soap.pdf";
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
boolean download=false;
     int fsize=0;
     res.setHeader("Content-disposition", "attachment; filename="+"soap.pdf" );
try
               URL url=new URL(fileURL);
     bis = new BufferedInputStream(url.openStream());
     fsize=bis.available();
     bos = new BufferedOutputStream(out);
while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
          try
                    bos.write(bytesRead);
                    count +=bytesRead;
                    bos.flush();
               }//end of try for while loop
               catch(StreamCorruptedException ex)
                    System.out.println("Exception ="+ex);
                    setError(ex);
                    break;
               catch(SocketException e)
                    setError(e);
                    break;
               catch(Exception e)
                    System.out.println("Exception in while of TestServlet is " +e.getMessage());
                    if(e != null)
                         System.out.println("File not downloaded properly"+e);
                         setError(e);
                         break;
                    }//if ends
               }//end of catch for while loop
}//while ends
          Exception eError=getError();
          if(eError!=null)
               System.out.println("\n\n\n\nFile Not DownLoaded properly\n\n\n\n");
          else if(bytesRead == -1)
          System.out.println("\n\n\n\ndownload \nsuccessful\n\n\n\n");
          else
          System.out.println("\n\n\n\ndownload not successful\n\n\n\n");
catch(MalformedURLException e)
System.out.println ( "Exception inside TestServlet is " +e.getMessage());
catch(IOException e)
System.out.println ( "IOException inside TestServlet is " +e.getMessage());
     finally
          try
     if (bis != null)
     bis.close();
     if (bos != null)
     {bos.close();}
          catch(Exception e)
               System.out.println("here ="+e);
}//doPost ends
public void setError(Exception e)
     exception=e;
     System.out.println("\n\n\nException occurred is "+e+"\n\n\n");
public Exception getError()
          return exception;
}//class ends
//ends
regards,
venakt

Similar Messages

  • Keep getting error message "The registry settings used by the iTunes drivers for importing and burning CDs ....please reinstall iTunes." I have done this several times but it doesn't help.

    Keep getting error message "The registry settings used by the iTunes drivers for importing and burning CDs ....please reinstall iTunes." I have done this several times but it doesn't help.

    Refer to this article:
    iTunes for Windows: "Registry settings" warning when opening iTunes
    http://support.apple.com/kb/TS3299

  • After updating to 7, now says that the sim card is missing? Have taken out the sim card several times, but it does not helps.

    After updating to iOS 7.0.1 ( I think it was, could also be iOS 7.0.2), now says that the sim card is missing? Have taken out the sim card several times, but it does not helps.

    See if this helps: http://support.apple.com/kb/TS4148

  • Hi I have got a iPad1 and tried to update to version 5.0.1 many times but never work.please help me.

    Hi I have got a iPad1 and tried to update to version 5.0.1 many times but never work.please help me.

    alway say it was corrupted
    Restore the iPad as a new device....
    How to set up your iPhone, iPad, or iPod touch as a new device

  • This query is running slw...please help to improve performance

    SELECT Listnontranstextid,
           Listnontransshort,
           Listnontransmedium,
           Listnontransextended
      FROM (WITH TEXT_T
                    AS (SELECT /*+ index(TT pk_text_translation) */TT.TEXTID,
                               TT.short,
                               TT.medium,
                               TT.extended
                          FROM TEXT_TRANSLATION TT
                         WHERE TT.Active = 1
                               AND (   TT.Short <> 'Null'
                                    OR TT.Medium <> 'Null'
                                    OR TT.Extended <> 'Null')
                               AND TT.Languageid = @Langid
                 FUNC AS (SELECT FN.ID
                            FROM Function_ Fn
                                 INNER JOIN Function_Type Fnty
                                    ON Fn.Functiontype = Fnty.Functiontype
                                       AND Fnty.Active = 1
                                 INNER JOIN Operation_Step_Function Osf
                                    ON (Osf.Functionid = Fn.Id)
                                       AND Osf.Active = 1
                                 INNER JOIN Operation_Step Os
                                    ON Os.Id = Osf.Operationstepid
                                       AND Os.Active = 1
                                 INNER JOIN Operation Op
                                    ON     Op.Id = Os.Operationid
                                       AND op.defaultoperationrevision = 1
                                       AND Op.Active = 1
                                       AND Op.Revisionstatusid NOT IN (2)
                           -- 2 means Operation Staus =Cancelled
                           WHERE FN.ACTIVE = 1
            SELECT TT.Textid AS Listnontranstextid,
                   TT.Short AS Listnontransshort,
                   TT.Medium AS Listnontransmedium,
                   TT.Extended AS Listnontransextended
              FROM function_translation ft
                   INNER JOIN TEXT_T TT
                      ON (TT.Textid = Ft.Textid)
                   INNER JOIN FUNC F
                      ON (F.ID = Ft.Functionid)
             WHERE Ft.ACTIVE = 1
            UNION
            SELECT /*+ index(Forout IF_FUNCTION_OUTPUT_ROUTING_02) */ TT.Textid AS Listnontranstextid,
                   TT.Short AS Listnontransshort,
                   TT.Medium AS Listnontransmedium,
                   TT.Extended AS Listnontransextended
              FROM Function_Output Fo
                   INNER JOIN Function_Output_Routing Forout
                      ON Forout.Functionoutputid = Fo.Id
                   INNER JOIN TEXT_T TT
                      ON TT.Textid = Forout.PromptTextid
                   INNER JOIN Function_Output_Routing_Type Fort
                      ON Fort.Id = Forout.Outputroutingtypeid
                   INNER JOIN Text_Translation Ttdt
                      ON     Ttdt.Textid = Fort.Textid
                         AND Ttdt.Languageid = @Langid
                         AND UPPER (Ttdt.Extended) = ('USER')
                   INNER JOIN FUNC F
                      ON F.ID = FO.Functionid
            UNION
            SELECT TT.Textid AS Listnontranstextid,
                   TT.Short AS Listnontransshort,
                   TT.Medium AS Listnontransmedium,
                   TT.Extended AS Listnontransextended
              FROM Function_Input Fi
                   INNER JOIN TEXT_T TT
                      ON (TT.Textid = Fi.Prompttextid)
                   INNER JOIN Function_Input_Source_Type Fist
                      ON Fist.Id = Fi.Inputsourcetypeid AND Fist.Active = 1
                   INNER JOIN Text_Translation Ttdt
                      ON     Ttdt.Textid = Fist.Textid
                         AND Ttdt.Active = 1
                         AND Ttdt.Languageid = @Langid
                         AND UPPER (Ttdt.Extended) = ('USER')
                   INNER JOIN FUNC F
                      ON F.ID = FI.Functionid
            UNION
            SELECT TT.Textid AS Listnontranstextid,
                   TT.Short AS Listnontransshort,
                   TT.Medium AS Listnontransmedium,
                   TT.Extended AS Listnontransextended
              FROM Function_Input_value Fiv
                   INNER JOIN function_input fi
                      ON fi.id = fiv.functioninputid
                   INNER JOIN TEXT_T TT
                      ON (TT.Textid = Fiv.textid)
                   INNER JOIN Function_Input_Source_Type Fist
                      ON Fist.Id = Fi.Inputsourcetypeid AND Fist.Active = 1
                   INNER JOIN Text_Translation Ttdt
                      ON     Ttdt.Textid = Fist.Textid
                         AND Ttdt.Active = 1
                         AND Ttdt.Languageid = @Langid
                         AND UPPER (Ttdt.Extended) = ('USER')
                   INNER JOIN FUNC F
                      ON F.ID = FI.Functionid
            UNION
            SELECT TT.Textid AS Listnontranstextid,
                   TT.Short AS Listnontransshort,
                   TT.Medium AS Listnontransmedium,
                   TT.Extended AS Listnontransextended
              FROM    cob_t_ngmes_master_data ctnmt
                   INNER JOIN
                      text_translation tt
                   ON tt.textid = ctnmt.textid
             WHERE tt.languageid = @Langid 
            UNION  -- Swanand, PR 190540, Added this clause to get the reasoncodes
            SELECT TT.Textid AS Listnontranstextid,
                   TT.Short AS Listnontransshort,
                   TT.Medium AS Listnontransmedium,
                   TT.Extended AS Listnontransextended
              FROM Reason_Code RC
                   INNER JOIN Reason_Type RT
                      ON RT.ReasonType = RC.ReasonType
                   INNER JOIN TEXT_TRANSLATION TT1
                      ON     TT1.textid = RT.textid
                         AND RT.ACTIVE = 1
                         AND TT1.ACTIVE = 1
                         AND (   TT1.Short <> 'Null'
                              OR TT1.Medium <> 'Null'
                              OR TT1.Extended <> 'Null')
                   INNER JOIN TEXT_T TT
                      ON TT.textid = RC.textid AND RC.ACTIVE = 1
             WHERE TT1.Languageid = @Langid 
            UNION
            SELECT TT.Textid AS Listnontranstextid,
                   TT.Short AS Listnontransshort,
                   TT.Medium AS Listnontransmedium,
                   TT.Extended AS Listnontransextended
              FROM NSPT_T_Event_Type ET
                   INNER JOIN TEXT_TRANSLATION TT1 ON TT1.TextID =
         ET.TextID AND TT1.ACTIVE = 1
                   INNER JOIN TEXT_T TT
                      ON TT.TextID = TT1.TextID
             WHERE  TT1.Languageid = @Langid  
                       ORDER BY Listnontranstextid ASC) WHERE Listnontranstextid > @I_TextIDEdited by: 964145 on Oct 26, 2012 4:53 PM

    Duplicate post ? Query running slow....need performance tuning

  • Iam posting this for third time but nobody is giving any reply: Please help

    One of our user created an ACH file and sent it to the bank for payment.He created this ACH file in one bank but by mistake sent it to other bank for payment.The payment has been cleared . Because of this my bank balances have changed. Could anyone help me to resolve this issue so that all my bank balances are set.Please give suggestions as early as possible . I will assign you points.Thanks in advance.

    Hi Kavitha,
    Reset and reverse the payment documents in FB08.
    And again run the payment run by selecting right bank
    ~Rajesh

  • I sent this question several times but have not received an email so that I can confirm.

    Here is the question:
    Firefox freezes or closes with any version past 3.6! Have tried various suggestions from online support. I am using Windows XP Pro with all updates, Comcast, Norton Security Suite, V5.1.0.2 updated. The only add-on that seems to work with newer versions is NoScript. I miss Colorful Tabs and Expended Copy Menu. Both those add-ons will freeze Firefox now. Sees like Firefox is going backwards instead of improving.
    I have gone into the registry, removed all Mozilla and Firefox entries and reinstalled 8.1. Didn't make any difference. Sometimes 8.1 will work for 3 or 4 sessions before freezing or not reloading. I then have to do a clean reinstall. I really, really don't want to go back and start using IE.
    Is this an issue for anyone else or just my computer which is about a year old? Sure would appreciate any help.
    Regards,
    Paleo

    Hi
    Well I have tried installing 8.1 without any add-ons and it will open once or twice. Then it will not open. I just reinstalled 3.6 to make this post. I have no issues with 3.6 but Mozilla has posted that this version will soon stop being supported. I can use 8.1 in safe mode with bookmarks enabled but not in regular mode!
    Thanks anyway for responding to my post.
    Regards,
    Paleo

  • I've tried to complete this album several times, but it won't let me?

    I've filled out my payment info and everything. But no matter how many times I've tried to complete the album, nothing ever happens.

    You can't setup (create) an iCloud account using a PC. You must use an Apple device, a Mac or an iPhone etc. Once you have created an account you can sign in from your PC.

  • Artwork   posted before but no reply, PLEASE HELP!

    Not showing up on iPod.
    I drag/ copy and paste or load my artwork to songs and albums on itunes and it works.
    I plug iPod in and it syncs it. But when I look at iPod I only see song name/ artist/ album, no artwork.
    Any reasons?
    Suggestions for help?
    I have posted before and got no answers!

    Try these steps, and see if it affects the way the album artowrk is showing (or lack thereof) on your iPod:
    1 - Connect your iPod to your computer.
    2 - In iTunes, click on your iPod in the Source List.
    3 - Under the "Music" tab, you will see an option called "Display album artwork on iPod".
    If this is already selected, try deselecting this option, click the Apply button to save your settings, and eject/disconnect your iPod.
    Then, reconnect your iPod to your computer, re-select this option, and disconnect it from your computer.
    If this setting was not selected when you checked on it right now, then simply check-mark this option, and click on the “Apply” button to save your changes.
    Then, disconnect your iPod from your computer, and see if the album artwork is working now.
    If that doesn't work, then have you first tried resetting your iPod? To reset an iPod:
    First, toggle your iPod's "Hold" switch back and forth a couple of times. (Make sure to leave it on the white side of the switch).
    Then, press and hold the Menu and Select (center) buttons together for 5-10 seconds.
    If a few attempts at resetting don't help with your issue, then I would now suggest that you try restoring your iPod to factory settings in iTunes.
    For info on restoring an iPod, see this article about that:
    Restoring iPod to factory settings
    -Kylene

  • Posted 2 times with no reply - please help

    Hi,
    I'm trying to write an applet that uses a rewritten version of ISNetworks SCP. My applet is used to scp a single file to a server. I dynamically need to name the file(when written on server), so the html that calls the applet is dynamically generated (in a servlet) & feeds the applet the filename(as a param). It works great the first time around. But I want users to be able to reuse this applet as they need. My applet is signed, so the security warning pops up the first time it is used. The next time the applet is run -- it just freezes (it & the browser). I have searched the forums& I see people have had the same type of problem for years (at least back to 1997) --- the jar is cached & the old applet is reused instead of the applet being reloaded. I see no answers in the Forum. The only fix so far is to close down the browser(ie or netscape) totally & restarting again. Here is my applet code
    package heather;
    import java.io.*;
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import mindbright.ssh.*;
    public class SCAROUpload extends Applet {
    String filename;
    Frame frame;
    AUSSHSCPDialog dialog;
    SSHPasswordAuthenticator pssAuth;
    public void init() {
    pssAuth = new SSHPasswordAuthenticator(AUStats.USER, AUStats.PSSWRD);
    frame = new Frame();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    dialog.dispose();
    frame.dispose();
    System.runFinalization();
    System.gc();
    frame.addNotify();
    frame.validate();
    public void start() {
    filename= getParameter("filename");
    dialog = new AUSSHSCPDialog(frame, pssAuth, filename); // the scp dialog
    dialog.show();
    I've tried the following
    - making the applet runnable & running it both with & without a 'start' button
    - launching from within a new window from a JSP
    - launching from a new window - with target="_blank" with in my html link
    Anyone got an answer for this problem? Any help is appreciated!!
    Heather

    I do not have the complete libraries and code to compile your code.
    One thing that comes to mind, if you are using anything Static, test without it. If the Applet reloads fine, then make sure you are using the Static correctly.

  • New video editing pc.. will this work ? i'm new here, please help me out

    hi everybody my name is mark, . i really hope i write and express myself correctly
    first of all i'd like to say i love this forum. there are some brilliant ppl here with great advice.
    special props to Mr Harm Millaard.. wow u know sum serious s*** !
    i'm a pro musician my thing has always been protools, recording production etc. its time for me to get into video using adobe premiere pro
    mostly i'll be doing my own music vids for my solo projects and for my band as well as professionally done as possible. i'm a nebie at all things video but i'm totally obsessive when it come to creative projects. it helps with the learning curve (:
    this is my courant rig setup
    http://http://www.newegg.com/Product/Product.aspx?Item=N82E16813131405
    http://CPU INTEL|CORE I5 750 2.66G R
    http://MEM 4Gx2|GSKILL F3-10666CL9D-8GBRL
    3 Wd hd's 160 500 and 640 gb's
    2 monitors 22' hanns g and a 19 "something
    i believe a 400 or 450 w powersupply
    stock vidow card
    2 cd/dvd
    i think that covers the basics
    AFTER OVER A WEEK OF RESEARCHING AND NO SLEEP THIS IS WHAT I CAME UP WITH FOR MY NEW RIG
    http://ASUS P6X58D Premium LGA 1366 Intel X58 SATA 6Gb/s USB 3.0 ATX Intel Motherboard
    http://Intel Core i7-950 Bloomfield 3.06GHz LGA 1366 130W Quad-Core Processor BX80601950
    http://G.SKILL Ripjaws Series 12GB (3 x 4GB) 240-Pin DDR3 SDRAM DDR3 1600 (PC3 12800) Desktop Memory Model F3-12800CL9T-12GBRL
    http://HITACHI Deskstar 7K3000 HDS723020BLA642 (0f12115) 2TB 7200 RPM SATA 6.0Gb/s 3.5" Internal Hard Drive -Bare Drive
    http://Western Digital VelociRaptor WD1500HLFS 150GB 10000 RPM SATA 3.0Gb/s 3.5" Internal Hard Drive -Bare Drive
    http://EVGA 012-P3-1470-AR GeForce GTX 470 (Fermi) 1280MB 320-bit GDDR5 PCI Express 2.0 x16 HDCP Ready SLI Support Video Card
    http://Thermaltake Black Widow W0319RU 850W ATX 12V v2.3, EPS 12V v2.91 CrossFire Certified 80 PLUS BRONZE Certified Modular Active PFC
    http://Antec Nine Hundred Black Steel ATX Mid Tower Computer Case
    total 1,399.92      i'm pretty much at my budget max
    will this setup be able to handle both my protools and adobe premier cs5? am i missing something ?
    what would be the best  HD set up wise for max audio/video performance  ? i was thinking a dual boot ?
    with  2 new hd's i'll have 5 all told.
      3 for video... 150 veloci raptor  2tb Hitachi and WD 640
    ..2 for protools... the wd 160 and the WD 500
    i guess i'm looking for the best way to set up my rig for max audio/video performance and pass the information on to my cuz who's in the pc building biz his thing is gaming not so much video editing.
    i really hope i wrote this out correctly so everybody can understand what i'm trying to say and will be able to give me the proper guidance i need
    let the suggestions begin
    thank u for your time
    Message was edited by: iammajick

    thanks for your support guys. it now looks like i'm changing up  my rig again. looks like were going to be going with a RAID set up
    3 x http://Western Digital Caviar Black WD1002FAEX 1TB 7200 RPM SATA 6.0Gb/s 3.5" Internal Hard Drive -Bare Drive
    1  http://Western Digital Caviar Black WD6401AALS 640GB 7200 RPM SATA 3.0Gb/s 3.5" Internal Hard Drive -Bare Drive which i already have on the rig i'm using
      my cousin gino orffitelli who's mainly a gamer builder for his company  ePro had this to say in an email to me last nite.. he gave kool props to the adobe forums
    'finally had a few min read through your email and skim the links you made in adobe'.....'as far as storage is concerend i believe the mobo's your looking at support RAID and from what i read thanks to your links, RAID 5 offers the best performance and saftey which means 4 HDD's.....' with the knowlege base your building and contacts u have you and i may just open a new direction for ePRO'.....
    i try my hardest to understand RAID but since i'm a novice with computers its really hard for me to grasp it...http://forums.adobe.com/thread/525263
    my brain is in overload insane trying to process all this (:
    so guys... RAID 5 with the rest of the hardware i'll be using  ?
      like i said i'd like to have  the max performance for my  audio/vidio rig.
    thanks again guys
    mark

  • HT4436 When ever I try to log into I Cloud it rejects my Apple ID I have changed it several times but all to no avail. Strangely I can use my ID to buy Itunes music. Can any one help please?

    Can anyone help? I am unable to log into ICloud. When I type in my ID and password it comes back with 'incorrect password' I have changed the password several times but it doesn't help. strangely i can use my paswod to buy buy Itunes music but not for Icloud. Any suggestions would be gratefully recieved.

    Hello CarenzaRielle,
    I know not being able to access your Apple ID can be frustrating. I have located an article that will walk you through a series of troubleshooting steps to resolve this:
    Apple ID: If you forget your password
    http://support.apple.com/kb/ht5787
    Refer to the Apple ID Support page if you are unable to reset your password using the steps in this article. If you know your Apple ID password, you can also choose to change your Apple ID or change your password.
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • I cant open Photos om my mac. Just upgraded to Yosemite. The message I get is: An unexpected error has occurred. Please quit and restart the application. I have done this several times but nothing seems to work. iPhoto is gone. What do I do?

    I just upgraded to Yosemite on my mac from 2010. Everything seems to work, accept Photos. When I try to open it i push the "Get started" button, then the picture with "Preparing Library" comes up. Then a message appears with the text "An unexpected error has occurred. Please quit and restart the application." I have done this several times, but nothing happens. What do I do?

    I just upgraded to Yosemite on my mac from 2010. Everything seems to work, accept Photos. When I try to open it i push the "Get started" button, then the picture with "Preparing Library" comes up. Then a message appears with the text "An unexpected error has occurred. Please quit and restart the application." I have done this several times, but nothing happens. What do I do?

  • Upgraded to 5.4 when opening lightroom get a message "encountered an error when reading from its preview cache and need to quite" tried this several time but get the same eror message

    Upgraded to 5.4 when opening lightroom get a message "encountered an error when reading from its preview cache and need to quite" tried this several time but get the same error message.  Says Lightroom will attempt to fix the problem the next time it launches but that is not happening.  How do it fix this?

    Delete the preview cache using your operating system. It is a folder whose name ends with Previews.LRDATA. Do not delete the Lightroom catalog, which ends with .LRCAT

  • I downloaded the iCloud control panel on my PC but can't sign in - message says "This apple ID is valid but not an iCloud account. I've tried the account set up several times but it keeps just spinning me in circles. Can you help?

    I downloaded the iCloud control panel on my PC but can't sign in - message says "This apple ID is valid but not an iCloud account. I've tried the account set up several times but it keeps just spinning me in circles, asking me to sign in and then I get the same message again. This is getting frustrating and I really don't seem to be able to get help. I can't contact customer support because I have a PC and there is a serial number of an apple device required.Can anyone help please?

    You can't setup (create) an iCloud account using a PC. You must use an Apple device, a Mac or an iPhone etc. Once you have created an account you can sign in from your PC.

Maybe you are looking for