Monitoring the progress of an HTTP File Request

Hi,
I've written a little applet used to sending Files to a PHP-Application. Everything works fine. Now I try to monitor the progress of the upload and I have a little problem. This are the main functions:
     public void addFile (String name, File file) throws IOException {
          this.bytesComplete = file.length();
          addFile(name, file.getPath(), new FileInputStream(file));
     public void addFile (String name, String filename, InputStream is) throws IOException {
          writeBoundary();
          writeName(name);
          write("; filename=\"");
          write(filename);
          write('"');
          newline();
          write("Content-Type: ");
          String type = connection.guessContentTypeFromName(filename);
          if (type == null)  {
               type = "application/octet-stream";
          writeln(type);
          newline();
          pipe(is, os);
          newline();
     private void pipe(InputStream in, OutputStream out) throws IOException {
          this.bytesWritten = 0;
          byte[] buf = new byte[4096];
          int nread;
          int navailable;
          int total = 0;
          synchronized (in) {
               while((nread = in.read(buf, 0, buf.length)) >= 0) {
                    out.write(buf, 0, nread);
                    out.flush();
                    total += nread;
                    this.bytesWritten += nread;
          out.flush();
          buf = null;
       }Somewhere else the function is called
     addFile ("file", filelist.get(i));Works fine, but now I've tried to monitor the actual progress by adding the following line between out.write and out.flush in the pipe-method
int actualStatus = Math.round (this.bytesWritten / this.bytesComplete * 100);
addProgress (actualStatus); // this method sets a JProgressBarAnd now something strange happens. It seems that all the data first is read so my progress goes to 100% in half a second and then is written later. I understand that os.flush only suggests (!) to write the data but not forces to do so.
Is there a way to monitor the progress in real-time, so I can show a user how many data already is transferred? To do a real forced flush? Thanks for your help

Maybe it's a bug: just found this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5026745
Does maybe anybody know a work-around?
Edited by: thomwiesel on 23.03.2010 13:44
Edited by: thomwiesel on 23.03.2010 13:45

Similar Messages

  • How to monitor the progress of an ORDER Number

    Hi,
    How can I Monitor the progress of an order from the EBS.
    Thanks
    Asis

    I assume you mean sales order.
    You can open the order header and go to tools > workflow status.
    It will show you when the order was entered , was booked and closed.
    You can also see details of all lines for the order.
    If you want to see status of a line, You can also go to line and go to tools > workflow status
    It will show you when it was entered, when booked, when it was progressed to next stages, and closed.
    Hope this helps,
    Sandeep Gandhi

  • Monitoring the Progress of a BufferedImageOp

    I just spent a couple of minutes figuring out how to do this and thought I might
    share it with anyone who's interested.
    Feel free to comment on, criticise, or improve on my approach.
    java.awt.image.BufferedImage sourceImage = ...;
    java.awt.image.BufferedImage targetImage = ...;
    targetImage.getSource().addConsumer(new java.awt.image.ImageConsumer() {
       private int pixelsDrawn = 0;
       public void setPixels(...) {
          // Update the number of pixels drawn so far:
          pixelsDrawn += width * height;
          // TODO: Tell other objects (e.g. a JProgressBar) about the update.
    java.awt.image.BufferedImageOp imageOp = ...;
    imageOp.filter(sourceImage, targetImage);NOTES:
    There are two setPixels() methods.
    Though it is not clear in the Javadoc, I assume only one will ever be called for
    a particular image source. Both still need to be implemented, however, on the
    assumption that you don't know which one will be called for this source.
    The Consumer seems to be notified one row at a time (with ConvolveOp, at least).

    hi
    I tried a similar approach, but i must tell you:
    1. usually one line is scanned in each setPixel say line 1, then line 2.....
    But for many filters these scanning is repeated several times, i.e. after all the lines has been scanned, the scanning is one again, i.e. line 1 is scanned again followed by the others. and this process is repeated 2-5 times depending on the filter.
    So i don't think we can get the progress the filter that way.
    If anyone got any good way to find the progress of a filter, please do let me know. my mailid is [email protected]
    Tanveer

  • Where does firefox cache the form parameters to be used in the reload event of a page that was the resposne of a HTTP POST request?

    Suppose there is form in a web page and it submits data in HTTP POST method. After submitting the form, if I reload the page [either by the refresh button or back button; whichever applicable], firefox asks permission to resend the form data by saying "To display this page, Firefox must send information that will repeat any action...". Now if the user clicks on the resend, firefox resubmits the form data.
    So where does firefox store this from data for such future resending/resubmission?
    Is it possible to retrieve/manipulate those stored form data?

    I thought I'd tried that, as tried lots of other things like encoding URL, but obviously not as this works.
    Thanks for the quick reply.
    We also have an issue with the people results not being able to be refined by Department or Job Title now we have connected the SP2010 farm to use the service applications from a SP2013 farm.
    Any ideas on this?  I've started a new thread as its unrelated though:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/c89d5463-4531-4a28-9586-1f690c7b580d/can-you-refine-people-search-results-using-a-sharepoint-2013-search-service-application-connected-in?forum=sharepointsearch

  • 1 I tried dowloading the free trial of indesign but it keeps stoping at 42 percent and won't budge. i have left it running for two days and there was still no progress. 2 I clicked on pin to notification in creative cloud so i could monitor the progress b

    need help

    If you had closed Creative Cloud application .
    Restart the computer once and check.
    If the Creative Cloud desktop app is launched ,
    Before starting installation of InDesign cc app.
    Clear temp folder.
    Please press Windows+R button together and you will get a run command window, please type-in %temp% and hit enter.
    Delete all contents present inside temp folder.
    You may skip the files which cannot be deleted.
    Then start the installation process for Indesign cc 2014.

  • Monitoring the progress of a delete operation

    Hello All ,
    I am deleting a table with 80M records based on rowid . But it appears that its running for so long .
    around 12 hrs . I can see an active session with delete statement . But no entry for that session id in v$long_ops .
    How can i find out the total percentage of completetion for session ? Please help me with the query
    Version Ora10gR2
    Thanks
    Aneesh

    Hi, if you're deleting much more than you keep i suggest you to:
    - create a "twin table"
    - insert the rows you want to to keep in the twin table
    - truncate the original table
    - re-insert the copied rows
    - commit
    - drop the copy table.
    The truncate table is much more faster than a delete the complete table (this is a DDL operation while the Delete is a DML operation)
    Sorry someoneElse i didn't see you last proposal (it's the same)
    Edited by: user11268895 on Jul 10, 2010 3:19 PM
    Another way to monitor this operation (if you are in PL/SQL) is to usethe dbms_Application_info package, here is an example:
    DECLARE
       i   NUMBER  := 0;
       f   BOOLEAN := FALSE;
    BEGIN
       WHILE NOT (f)
       LOOP
          DELETE FROM t1
                WHERE rwonum <= 20000;
          i := i + SQL%ROWCOUNT;
          DBMS_APPLICATION_INFO.set_client_info (   i
                                                 || ' record have been deleted...'
          COMMIT;
          IF SQL%ROWCOUNT < 20000
          THEN
             f := TRUE;
          END IF;
       END LOOP;
    END;then you'll be able to see how many rows were deleted at "any" time:
    SELECT client_info,v.*
      FROM SYS.v_$session vEdited by: user11268895 on Jul 10, 2010 3:20 PM

  • Explicitly setting the query string in http get request

    Hi All,
    We are trying to use the query string parameter to send a GET request to a vendor. The parameter value is a string concatenated with xml ie. String=<xml></xml> It seems the vendor is reading this value as string and Looking for "<XML>" to strip out the values. The problem in OSB is when I concatenate the fn:concat("String=",<XML/>) the acutal value is translated to "String=&lt;XML/>. Is there a way to explicitly set the value so the < doesn't get encoded to &lt; ? the odd thing is that only the left less than bracket get encoded. Any help would be most appreciated...
    thanks,
    Matt
    version of OSB:
    Service Bus 10gR3
    Oracle Service Bus Version: [WebLogic Oracle Service Bus 10.3 Sat May 30 06:12:38 EDT 2009 1223943 ]
    Oracle Weblogic Server Version: [WebLogic Server 10.3 Fri Jul 25 16:30:05 EDT 2008 1137967 ]

    The left side bracket is actually getting encode as amplt; (this forum encoded it :))

  • How do I read the XML string using Http response/request?

    When my HTTP POST action is perform, the action will return me a XML string as shown in the link, https://www.neteller.com/gateway/netdirectv4.cfm?amount=150.00&net_account=458415554241&secure_id=896365&bank_acct_num=6789&currency=USD&merchant_id=1234&merch_transid=1102&merch_account=john123&custom_1=test123&custom_2=test123&custom_3=test123&test=1
    The above XML string will be send back by one of the payment gateway.
    How do I retrieve all the attribute name and value from the XML string so that it can be stored in my database?
    The XML string will be as shown below:
    <?xml version="1.0" encoding="ISO-8859-1"?><netdirect version="4.0">
              <approval>yes</approval>
              <amount>150.00</amount>
              <trans_id>403070</trans_id>
              <error>none</error>
              <fee>4.35</fee>
              <time>{ts '2006-06-23 06:14:19'}</time>
              <firstname>Test</firstname>
              <lastname>Test</lastname>
              <email>[email protected]</email>
              <custom_1>test123</custom_1>
              <custom_2>test123</custom_2>
              <custom_3>test123</custom_3>
              <dafee>0.00</dafee>
              <client_currency>USD</client_currency>
              <client_amount>150.00</client_amount>
              <merchant_currency>USD</merchant_currency>
              <merchant_amount>150.00</merchant_amount>
              <fxrate>1.0</fxrate>
              </netdirect>

    How about parsing the XML? Check out JAXP.
    http://java.sun.com/webservices/jaxp/index.jsp

  • I want to have a progress bar monitor and display the progress of a file being opened, How do I do it?

    I have written large files for a report. When I open the files in the VI by pushing a button I want to view the progress of the file being opened. My first thought was to get the file size, some how measure the number of bytes comming out and monitor it on the progress bar. I am unsure about how to do this. If you know of a better way to monitor and disply the progress of an opeing file please let me know.

    If I understand you correct the progress bar is not the problem, it's to get a numeric value indicating the progress...right?
    If so then you could read the file size, preallocate a byte array to hold the file, then read it in chunks and put the chunks into the array using replace array elements...(you could concatinate strings, but that would easily become very memory and speed expensive...)until you have read the entire file. If the file is 20 MB and you want the progress bar to have a resolution of about 1% read it in chunks of 256 KB...For each chunk read, increment the progress bar...
    MTO

  • How to check the progress of a BPM process I started ?

    Hi,
    I used to build workflow with Guided Procedure, and there is a GP Runtime Workcenter where a user can find the processes he/she started, or being as an admin/overseer/owner. For GP, it is much more powerful than UWL.
    Now I'm testing BPM with the following secnario, but I don't know how the user starting a process to monitor the progress with UWL ? (I do not think NWA is a good tool for BPM user, correct me if I'm wrong )
    My scenario is : User fill in a leave-request data form built with Web Dynpro iView (not part of BPM task), and click submit, the iView start a BPM process. This process will go through the approvers. The user need to check the progress.....how can he/she find the process in UWL ? (He/She has no working items)
    I really want to know the best practice to present the process prgress to a user who is relative to the process instances (as initiator, admin, or participant)
    Thanks

    Hi,
    You can do it several ways.
    1> a) After starting the process, go to NWA [http://<hostname>:<port>/nwa]
         b) Go to 'Operations' -> Processes and Tasks' -> 'Manage Process'.
         c) Choose the Process instance you started and click on the 'Process flow'.
    This will show you a page with the process digram with a grenn 'token' beside the active step.
    2> The other way ( dificult to achieve, easier to use)
         a> During  process design, for every human activity UI, write down the process steps on task UI.
         b> Highlight the step  for every human task.
         c> When the user opens the tak UI from UWL, then can see the process step at which they are stuck.
      This method wont work if the process is stuck at any 'automated activity' or sub-process.
    Hope these help.
    Edited by: Subhra Jyoti Saha on Jul 6, 2010 7:04 AM

  • How do you monitor backup progress

    How can you monitor the progress of a backup? I use timemachine and an external drive  to do my backups on my 09 Macbook pro. I want to be able to see the amount of files transferred and time remaining or any other pertinent info. Not just a spinning wheel.

    I don't know, I use bootable clones myself and it shows me the progress of the backup and updating of files.
    However I can point you to this guy who is the local TM guru
    All about Time Machine
    If you want to learn more about all sorts of backups to diversify your restore options (TM can fail to restore properly), including bootable clones etc. then read my UT here on the subject.
    Most commonly used backup methods explained
    I personally don't use TimeMachine, preferring the more advanced bootable clone options.

  • How to monitor the load on web dispatcher

    We have implemented a web dispatcher in our landscape for our portal production servers. We have 3 application servers that are being accessed through the web dispatcher. Sometimes users get the error "Service Temporarily Available" when accessing the portal. How do i check the load on the web dispatcher. Which is the parameter that sets the maximum number of connections?
    Regards,
    Sridevi

    To be able to administrate the SAP Web dispatcher in the Web interface see [Monitoring the SAP Web Dispatcher|http://help.sap.com/saphelp_nw04/helpdata/en/05/ac923fa5e93c17e10000000a114084/frameset.htm]. To do so, call SAPCAR as follows: SAPCAR u2013xvf icmadmin.SAR
    You can find the archive file ICMADMIN.SAR like the SAP Web Dispatcher in the kernel package  DW.SAR.
    More info u can find: http://help.sap.com/saphelp_nw04/helpdata/en/0b/25453cf1fcc85ee10000000a11402f/frameset.htm
    Hope this helps

  • Invalid Http header request

    When I try to go to Yahoo.com on Safari I get the following Message:
    Invalid Http Header Request
    Anyone have any suggestions?

    Clear the cache and the cookies from sites that cause problems.
    *"Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    *"Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    If clearing the cookies doesn't help then it is possible that the file <i>cookies.sqlite</i> that stores the cookies is corrupted.<br />
    You can rename (or delete) <b>cookies.sqlite</b (cookies.sqlite.old) and delete <b>cookies.sqlite-journal</b> and <b>cookies.txt</b>, if they exist, in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder] in case cookies.sqlite got corrupted.
    See [[Cannot log in to websites]] (Remove corrupt cookies file)<br />
    See also http://kb.mozillazine.org/Websites_report_cookies_are_disabled (Other Solutions)

  • Select the progress of an another sql statement

    What I want to do is to monitor the progress of a sql statement which takes a long time. How many percent of the statement is already done.
    I know there is the possibility to do this with a query.
    But I can' t remember how to do this exactly.
    Can somebody help me?
    Thanks a lot!

    Here is a SELECT that I usually run:
    COLUMN MODULE FOR A20
    COLUMN OPNAME FOR A20
    COLUMN SOFAR FOR 999999999999
    COLUMN TOTALWORK FOR 999999999999
    COLUMN UNITS FOR A20
    COLUMN REMAINING FOR 999999999
    COLUMN ELAPSED FOR 999999999
    SELECT
               S.SID
              ,S.AUDSID
              ,S.OSUSER
              ,S.MODULE
              ,L.OPNAME
              -- ,TARGET                
              -- ,TARGET_DESC           
              -- ,CONTEXT               
              ,L.SOFAR
              ,L.TOTALWORK
              ,L.UNITS
              ,L.START_TIME            
              ,L.LAST_UPDATE_TIME
              ,L.TIME_REMAINING REMAINING
              ,L.ELAPSED_SECONDS ELAPSED
              -- ,MESSAGE               
              -- ,USERNAME              
              ,L.SQL_ADDRESS
              -- ,SQL_HASH_VALUE        
              -- ,QCSID       
              -- ,A.SQL_TEXT
         FROM V$SESSION_LONGOPS L
              ,V$SESSION S
              -- , V$SQLAREA A
         WHERE L.TIME_REMAINING <> 0
              AND L.SID = S.SID
              AND L.SERIAL# = S.SERIAL#
    ;Note that V$SESSION_LONGOPS as a rule does not show long operations which take a lot of index range scans - this is not a "long operation"

  • How to check the progress of statistics gathering on a table?

    Hi,
    I have started the statistics gathering on a few big tables in my database.
    How to check the progress of statistics gathering on a table? Is there any data dictionary views or tables to monitor the progress of stats gathering.
    Regds,
    Kunwar

    Hi all
    you can check with this small script.
    it lists the sid details for long running session like
    when it started
    when last update
    how much time still left
    session status "ACTIVE/INACTIVE". etc.
    -- Author               : Syed Kaleemuddin_
    -- Script_name          : sid_long_ops.sql
    -- Description          : list the sid details for long running session like when it started when last update how much time still left.
    set lines 200
    col OPNAME for a25
    Select
    a.sid,
    a.serial#,
    b.status,
    a.opname,
    to_char(a.START_TIME,' dd-Mon-YYYY HH24:mi:ss') START_TIME,
    to_char(a.LAST_UPDATE_TIME,' dd-Mon-YYYY HH24:mi:ss') LAST_UPDATE_TIME,
    a.time_remaining as "Time Remaining Sec" ,
    a.time_remaining/60 as "Time Remaining Min",
    a.time_remaining/60/60 as "Time Remaining HR"
    From v$session_longops a, v$session b
    where a.sid = b.sid
    and a.sid =&sid
    And time_remaining > 0;
    Sample output:
    SQL> @sid_long_ops
    Enter value for sid: 474
    old 13: and a.sid =&sid
    new 13: and a.sid =474
    SID SERIAL# STATUS OPNAME START_TIME LAST_UPDATE_TIME Time Remaining Sec Time Remaining Min Time Remaining HR
    474 2033 ACTIVE Gather Schema Statistics 06-Jun-2012 20:10:49 07-Jun-2012 01:35:24 572 9.53333333 .158888889
    Thanks & Regards
    Syed Kaleemuddin.
    Oracle Apps DBA
    Mobile: +91 9966270072
    Email: [email protected]

Maybe you are looking for

  • No longer able to boot - failure with /boot

    I recently, due to a hard drive change, rebuilt my desktop.  Every now and again, since then, it hasn't booted.  I just logged into root and rebooted; figuring I'd sort it out at some point. Only, now it won't boot at all.  When I go through journalc

  • Can I add a Pages document to an iPhoto journal?

    I have created an iPhoto journal from photos taken at my high school graduation. Can I add a Pages document listing our deceased classmates to this journal?

  • After Yosemite Update Battery Wont Charge

    After the Yosemite update my battery will not charge. Yellow light on power adaptor, reset SMC and PRAM - still nothing. Sits at 0%. Any ideas?

  • Having Trouble

    Okay. So I have the latest version of iTunes, and it works fine with my 5G, but when I try to work with my brother's shuffle, things go wrong. Not only can I not put any new songs on, but it gives me an error message when I try to restore it. It also

  • Rpm for OEL 5.5

    Hi, I have to install oracle database 11gR2 on OEL 5.5. In order to install required rpm, does exist an rpm package that installs all required packages?