Timed HTTP upload via openConnection

Hi there,
I've been trying to perform a HTTP POST request which sends as much of a large payload as possible, recording how much is uploaded, within a given timescale.
write() and flush() within my while loop do not seem to write any data to the socket however, and the console doesn't suggest any errors were encountered. 'data' has many megabytes of data to upload.
Would welcome any ideas?
BP
//Init
threadTimeStart = System.currentTimeMillis();
theadTimeStop = threadTimeStart + 10000; // 10 seconds
int writtenByteCount = 0;
// Open connection
URL u = new URL("http://hostname/filepath");
URLConnection uc = u.openConnection();
uc.setDoOutput(true);
// Write data
OutputStreamWriter wr = new OutputStreamWriter(uc.getOutputStream());
// BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(uc.getOutputStream())); // has been tried also
String data = URLEncoder.encode("upload_data", "UTF-8") + "=" + URLEncoder.encode(data, "UTF-8");
while ( writtenByteCount < data.length() ) {
     wr.write(data, writtenByteCount, 1024);
     wr.flush();
     writtenByteCount += 1024;
     System.out.println("writtenByteCount: " + writtenByteCount + " of maximum " + data.length() + " bytes" );
     if ((double) System.currentTimeMillis() > TimeStop) break;
// Get response
BufferedReader br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String line = null;
while ((line = br.readLine()) != null) {
     // **process response**
// Close connections
wr.close();
br.close();

Since your URLConnection will be an HttpURLConnection you can cast it to an HttpURLConnection and use method
HttpURLConnection#setChunkedStreamingMode(1024); // Or whatever chunk size you want.

Similar Messages

  • Which is your favorite sharpen skill for image to print and to upload via web

    Hi
    which is your favorite sharpen skill for photo ?
    which skill do you use for a print or upload via web like flirck ,one exposure
    i like a lot this skill  http://www.photoshopsupport.com/tutorials/sharpen-an-image/photo-sharpening.html
    i know what would you think ... every image has a sharpen skill
    but i would like to know your favorite or more used for print or web upload
    thanks
    cheers

    Personally I'm fond of working at an upsampled resolution then sharpening near the end of my workflow, then downsampling for use as a work product.
    Example:  Work at double (or more) the pixel count you'll need for web publishing, sharpen fairly aggressively, then downsample.  That tends to get you highly detailed looking results that are cleaner of sharpening artifacts.
    As far as just sharpening things, I invented my own set of actions that employ fractals... 
    -Noel

  • Upload via FTP issue

    I'm unable to upload via FTP to my GoDaddy hosting account.  HELP!!

    I followed the steps illustrated in the documentation below
    https://helpx.adobe.com/muse/using/uploading-site-third-party-hosting.html#Using%20the%20b uilt-in%20Upload%20to%20FTP%20Host%20functionality
    My Adobue Muse hangs up for good 5 minutes and then returns back with error message of invalid User Id and Password.  Where as I know my UID and Password for my GoDaddy account.
    All, im trying to do is Upload my site pages into www folder via FTP feature but its not working.  Its very frustrating.
    I even tried adding port 21 after colon e.g. ftp.domain_name.com:21
    Please help!

  • MDG-C  initial upload via IDOC XML

    Hello All,
    I am uploding Customer master data initial load using IDOC xml, where i am getting below error.
    "ID of the local system cannot be determined".
    I have Logical system configured with inbound parameters message type DEBMAS. Any thing else i am missing?  Please help.

    Uploading via idoc xml .. if there is another connected SAP system .. I wouldnt prefer it as you could directly transfer it via the idocs.
    However, this is a simple config as per the config guide available under the MDG help for 6.1. Please check if you have followed all the settings.
    Data Export from Source System
    http://help.sap.com/erp_mdg_addon61/helpdata/en/68/edb50f21e74fd486009959ce2d72cd/content.htm?frameset=/en/77/29ad50e6542f3ce10000000a44538d/frameset.htm

  • I am having issues with my web module on Lightroom 4 (Mac OS 10.9.5). "an unknown error occurred" while trying to upload to my FTP (no changes in my FTP). Bandaid fix was to export to local folder and upload via Filezilla. However, now that is no longer w

    I am having issues with my web module on Lightroom 4 (Mac OS 10.9.5). "an unknown error occurred" while trying to upload to my FTP (no changes in my FTP). Bandaid fix was to export to local folder and upload via Filezilla. However, now that is no longer working and although upload completes, the URL takes you to a "Forbidden - do not have permission to read this file" page. Lightroom is changing the permissions of each file to 000 instead of 644 for index files and 755 for all others. How can I change the permissions settings in Lightroom?

    I am having issues with my web module on Lightroom 4 (Mac OS 10.9.5). "an unknown error occurred" while trying to upload to my FTP (no changes in my FTP). Bandaid fix was to export to local folder and upload via Filezilla. However, now that is no longer working and although upload completes, the URL takes you to a "Forbidden - do not have permission to read this file" page. Lightroom is changing the permissions of each file to 000 instead of 644 for index files and 755 for all others. How can I change the permissions settings in Lightroom?

  • COPA Planning-Upload via KE13N

    Hi Experts ,
    I am doing COPA planning , but stuck with the excel upload via T code KE13N.
    -I have defined the planning level on the basis of the sales organisation
    -Planning packages on basis of years.
    -Paramater set has also been defined. Integrated excel is checked here .
    -While saving the planning layout i have defined the coloumns for Company code, distribution channel, division as Lead columns.
    When i am trying to execute the parameter set, excel gets generated. i am unprotecting the excel and doing the changes in layout, Since i want Characteristics in rows and Values in their corresponding columns . i save that excel to my desktop in text format.
    After this in KEPM i goto settings > fomatting > Save file description.
    It gives me mesage " File description 02_CE1CA00__SAP_001TEST7 was saved"
    After this i goto KE13N and trt to upload the text file i created before but i get the error message
    "File description 02_CE1CA00__SAP_001TEST 7 does not exist".
    Cld u pls advise where i am going wrong .

    Hi Christian,
    Thanks for your reply.
    I have corrected that error, now if i am trying to upload it is giving me the below 2 errors :
    1.Entry should have template  ___.____
    Message no. RRKEB001
    2.Error occurred when generating data for the planning processor
    Message no. K9400
    Cld u pls help me with this .
    Thanks !!
    Mani

  • I recently updated to ios 6.1.1 and since then, the photos i am uploading via ios does not show on my timeline or on the newsfeed, but the pictures show in the album. can you help me with it? thanks.

    i recently updated to ios 6.1.1 and since then, the photos i am uploading via ios does not show on my timeline or on the newsfeed, but the pictures show in the album. can you help me with it? thanks.

    fingers crossed, it appears they are working the bugs out of this update....i was able to post a pic to my newsfeeds/time line this morning....first the picture went into the ios album but within a minute, it appeared on my timeline! im glad ...

  • File Upload via CSOM is incrementing Version number by 2.

    Any ideas why a file upload via CSOM is incrementing the version number by 2 instead of one?
    I am using the following code to perform the upload
    List library = clientContext.Web.Lists.GetByTitle(DOCUMENTS_LIST_NAME);
    Folder folder = library.RootFolder;
    FileCreationInformation fci = new FileCreationInformation();
    Byte[] streamArray = new Byte[document.ContentLength];
    document.InputStream.Read(streamArray, 0, document.ContentLength);
    fci.Content = streamArray;
    fci.Url = documentTypeID + "." + document.FileName.Split('.').Last<String>();
    fci.Overwrite = true;
     File fileToUpload = folder.Files.Add(fci);
    clientContext.Load(fileToUpload);
    clientContext.ExecuteQuery();

    It may actually be to do with the metadata that is setting immediately after this code.
    Is there a way of overcoming that and including the file upload and the item update in one version?

  • HTTP Upload Problem

    I have an JSP application that uses a JSP component to upload files onto any location on the web server. The component has a saveAs method to save the file on the web server. This functionality works great on the iFS Apache Server(solaris). It will not work when I save the file to an IFS folder. No error message. I am creating a XML file (that contains Custom Document Class) on the fly in my JSP. Ideally I would like to save it to iFS and have it automatically parsed.
    I check my ACLs for the iFS destination folder (set to Public).
    What would be the best way to get my documents into iFS given the scenerio described above.
    null

    Neil
    I'm not sure I understand your applicaiton. From your description it appears that your JSP is able to successfully navigate the Unix Directory and save the files on the Unix File System - is this correct ?
    Now you appear to be trying to use the save application to navigate the iFS Folder Heirarchy and save files there. Since it is not currently possible to expose the iFS Folder Hierarchy as a Unix File System you will need to write a totally seperate set of logic that will use the iFS Java API to navigate the iFS Folder Heirarchy and to accept the input stream containing the uploaded document.
    This would require a completely different JSP to one which browses the native file system. This would be similar to the Upload via Browse function of the standard iFS WebUI

  • Web upload via ImageMixer 3 Launcher

    I have a canon vixia hf m301. I could not  to do web upload via ImageMixer 3 Launcher. Windows XP explorer could see sd card but the software could not see it. What to do next?
    Thank,
    cherngchai

    Hi Cherngchai,
    For the best answer, I recommend calling Pixela for assistance.  Here's their contact information:
    Telephone support: 1-800-458-4029 Monday-Friday 9:00 a.m. - 6:00 p.m. (PST)
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • How To Upload Via FTP In Safari?

    How do you upload via FTP in Safari? I can't find ANYTHING in the Safari Help pages about FTP. No mention of it whatsoever. Yet, I know it can be done.
    I entered my own FTP address into the Address Bar and typed in my username and password. I successfully "logged in" to my own webspace. I could see all my files and folders. However, I could neither upload/add or delete any files. Why is this?
    I used to be able to do this in Internet Explorer on a PC with no problems. Why can't Safari and a Mac do it?

    I don't believe you can use Safari for the FTP upload function. This is done via the Finder.
    In the Finder: Go menu>Connect to Server or "Apple Key + K":
    Enter the FTP address in the browser window (click on the + sign to retain the address) and select "connect" . Once the connection is made, the Server will appear in the Finder Window on the left sidebar. You can drag/drop files to this location, or drag/drop from this location to your Finder.
    If you need something more sophisticated, a Google Search under "FTP Mac Intel" might prove helpful.
    iMac G5 Rev C 20" 2.5gb RAM 250 gb HD/iBook G4 1.33 ghz 1.5gb RAM 40 gb HD   Mac OS X (10.4.8)   LaCie 160gb d2 HD Canon i960 printer, Airport Express (2 units)

  • Starting HTTP server via OEM

    win2000
    When I try to start the HTTP server via the OEM, I get the following error message : "Preferred Credentials has not been set"
    where do I set it? thnx
    Endre

    i also met this problem even for backup,recover. when I give the username/passwd, no wrong is given.but when I use these functions, they ask me give the Credentials. Now I am seeking the answer.

  • Upload via Email

    Is it possible to forward emails to workspaces? If so, will attachments upload via email, or only the body of the email?

    Good day,
    Unfortunately it is not possible to email to Workspaces.
    Kind regards,
    David
    Adobe Systems

  • I am having problems uploading via desktop to CC

    I am unable to upload anything via my desktop to Creative Cloud. Uploading via the web interface from my local machine is working, however, and appears on my desktop.
    I am using a Mac (10.9.4) and on Creative Cloud (1.81.451).
    If you require further information, please let me know.

    Moving the discussion to File Hosting, Syncing, and Collaboration.
    Thanks,
    Atul Saini

  • New update, can't upload via ftp

    Just updated muse, whem i'm trying to upload my site using the built in ftp-client it stops uploading at the first picture, any idea what I should do?

    Hi,
    Could you please to export the site as html and upload via any third party FTP client, and see if that works,

Maybe you are looking for

  • Adding Query String Parameters to Table loadData

    I am new to ADF/JDeveloper, so hopefully this is a simple question... I have created an ADF task flow containing a table of fake weather data. This data is loaded using a URL Service Data Control. The URL service takes a zip code as a querystring par

  • SMTP OUTGOING SETTINGS NOT WORKING

    My outlook mails through rediffmail getting stucked on mail_sits_in_outbox smtp settings are correct

  • TV keeps cutting out for anywhere from 2 - 20 seconds

    My TV service cuts out arbitrarily (screen goes blank) for anywhere from 2 to 20 seconds. Tends to happen more often and more frequently in the evenings.  It is occurring both on my HD-DVR box as well as my standard STB.  All the boxes are Motorola. 

  • What is the best web compression ?

    Hi all web compression experts, I have been trying to find out what is the optimum settings for files to be downloaded on the facebook. The limit I set is 100MB. But when i rendered my 6.5 mins video in FCE, the filesize for the .mov file is a whoppi

  • IPhoto 8.1.2 won't load

    Hi all, I have: iPhoto 8.1.2 Macbook OS 10.6.7 At some point iPhoto simply stopped loading. When it is opened, it shows a "blank" screen - no photos, nothing in the side bar. Then the beach ball just spins and spins and spins. I have used Disk Utilit