Downloading Text file over http

Hi,
I am trying to display some plain text files over http to the client using a web browser. Everything works fine till the time the file size is small, but for the files of over 1MB the frontend just dies. Probably the display happens only after the complete transfer of the file.
Does any one have the solution by which the text files can also be downloaded similar to the html files i.e. incrementaly. I have the code of transferring the html file over http as it happens in the explorer. But the same does not seem to work on the plain text files.
Please help
Sachin

I do not have any Remote server written for this. What i am doing is, the directory in which the files are stored is exposed as a virtual directory through a web server(Apache) and then from client i am just placing a http request to open this file.
So what i can do under this situations to handle the large files.

Similar Messages

  • Cannot download file over https behind firewall ?

    I have a program to download files :
    public class TestServlet
         public static void main(String args[]){
        Authenticator.setDefault(new AuthImpl());
         if (args.length!=2){
          System.out.println("Proper Usage: java -Dhttp.proxyHost=172.21.32.166 -Dhttp.proxyPort=80 TestServlet RemoteFileURL LocalFileName");
           System.out.println("Usage Example:java -Dhttp.proxyHost=199.67.138.83 -Dhttp.proxyPort=8080 TestServlet https://url.com/csv/file.zip file.zip");
          System.exit(0);
         DataOutputStream out=null;
         FileOutputStream fOut=null;
         try
          trustAllHttpsCertificates();
          String urlStr = args[0];
              HostnameVerifier hv = new HostnameVerifier() {
                   public boolean verify(String urlHostName, SSLSession session) {
                        System.out.println("Warning: URL Host: "+urlHostName+" vs. "+session.getPeerHost());
                        return true;
             HttpsURLConnection.setDefaultHostnameVerifier(hv);
              System.out.println("\nConnecting to Website . . . "+urlStr);
              URL url = new URL(urlStr == null ? "https://url/Downloads/WC.csv" : urlStr);
              System.out.println("\nConnecting . . . . ");
              BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
              System.out.println(". . . Connected");
              System.out.print("\nDownloading the file . . . ");
              int buff;
              fOut=new FileOutputStream(args[1]);
              System.out.print(" . .");
              out=new DataOutputStream(fOut);
              System.out.print(" . .");
              while ((buff = in.read()) != -1) {
                fOut.write(buff);
              in.close();
            System.out.println(" . . . Done \n");
          catch (Exception e) {
                e.printStackTrace();
           finally {
              try{
                   fOut.flush();
                   fOut.close();
                   System.exit(0);
               catch(Exception e){
                   e.printStackTrace();
        HostnameVerifier hv = new HostnameVerifier()
            public boolean verify(String urlHostName, SSLSession session) {
                //System.out.println("Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost());
                return true;
        private static void trustAllHttpsCertificates() throws Exception
             //  Create a trust manager that does not validate certificate chains:
            javax.net.ssl.TrustManager[] trustAllCerts =  new javax.net.ssl.TrustManager[1];
            javax.net.ssl.TrustManager tm = new miTM();
            trustAllCerts[0] = tm;
              javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance("SSL");
            sc.init(null, trustAllCerts, null);
            javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
        public static class miTM implements javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager {
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return null;
            public boolean isServerTrusted(java.security.cert.X509Certificate[] certs) {
                return true;
            public boolean isClientTrusted(java.security.cert.X509Certificate[] certs) {
                return true;
            public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
                    throws java.security.cert.CertificateException {
                return;
            public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
                    throws java.security.cert.CertificateException {
                return;
       public static class AuthImpl extends Authenticator {
       protected PasswordAuthentication getPasswordAuthentication() {
          String username = new String("guest");
    String password = new String ("guest");
           return new PasswordAuthentication(username, password.toCharArray());
    }This program works fine for downloading files, over both http and https from my home. When I run this on my desktop in the office it can download files over http, but cannot download https files.
    When I try to download files over https, I get the foll. exception:
    java.net.UnknownHostException: www.site.com
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
    at java.net.Socket.connect(Socket.java:452)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA12275)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(DashoA12275)
    at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA12275)
    at sun.net.www.protocol.https.HttpsClient.doConnect(DashoA12275)
    There are 2 differences here, one being that my office desktop sits behind a firewall and there is a proxy in between.
    In the office I run the program as :
    java -Dhttp.proxyHost -Dhttp.proxyPort TestServlet URL [filename]
    eg.:
    java -Dhttp.proxyHost=235.67.138.84 -Dhttp.proxyPort=8080 TestServlet https://site.com/portal/Downloads/file.csv file.csv
    This url requires authentication, the userid and pwd are hardcoded in the code.
    Now, my problem is I cannot understand why this error would come. Is it because of the firewall or because of the proxy ?
    Why is it that I can download over http successfully from my office desktop? If the problem is with the firewall or proxy, then even http protocol urls should give the same problem.
    Please help.
    Vinay
    Message was edited by:
    vinay_dsouza
    Message was edited by:
    vinay_dsouza

    If you are using HTTPS you should be setting
    https.proxyHost
    https.proxyPortnot the http.* ones.

  • Downloading files over HTTPS

    how can i upload files over https
    can you give me some links to web sites that explain this
    thank u

    Hi..
    Have you got the information yet ?
    I need more information for uploading file in https.
    Thanks in advance

  • How can I download a file over the internet from a WebDAV server?

    I am trying to download a file over the internet from a WebDAV server. I've tried doing it with Datasocket as suggested in these articles,
    <a href="http://digital.ni.com/public.nsf/websearch/f3cc5f7e60a75cb2862567e700696abf?opendocument">Retrieving an Unformatted Text File via FTP or HTTP Using DataSocket</a>
    <a href="http://digital.ni.com/public.nsf/websearch/4FA09E7B3674DA34C1256BD400555C41?OpenDocument">Download a Text File from a Password Protected URL Using DataSocket</a>
    but all I get is error 1181 (protocol unrecognized by Datasocket).
    I know I have the URL correct, because I can put it into a web browser and it works fine - I can download the file manually.
    But I want to have a LabVIEW program do the download automatically.
    I have the internet toolkit, but don't have the foggiest clue how to use it, and am using LabVIEW 7.1
    I am a bit out of my depth here, so any advice welcome.
    Regards,
    Mark.

    MIG,
    What is the URL to the website? Is it an FTP site? The articles you referenced are for specific transfer protocols. If the stie you're trying to get to doesn't follow these protocols, then you'll get the error you're seeing. You may have to use ActiveX to control IE and download the files programmatically.
    Chris C
    Chris Cilino
    National Instruments
    LabVIEW Product Marketing Manager
    Certified LabVIEW Architect

  • Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout).

    Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout). It is as if the server has decided that the client has timed out during the file upload. The default setting is 30 seconds for AcceptTimeout in the magnus.conf file. This should be ample to get the file across, even increasing this to 2 minutes just produces the same error after 2 minutes. Any help appreciated. Apologies if this is not the correct forum for this, I couldn't see one for iPlanet and Web, many thanks, Kieran.

    Hi,
    You didnt mention which version of IWS. follow these steps.
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    Regards
    T.Raghulan
    [email protected]

  • Problem downloading a file via http

    Hi
    I'm just getting started with WLS (sp5) and am having a problem downloading
    a file via http. The document is stored in the main html docs directory and
    whenever I link to it or try to download it directly (eg:
    http://<host>:<port>/myfile.doc) I get the following error in a message box:
    Your current security settings do not allow this file to be downloaded.
    Can anyone point me in the right direction as to where I grant permissions
    to do this - I've tried using the weblogic.security.URLAclFile and adding
    the directory as a weblogic.io.fileSystem (a desperation move, I know).
    Thanks in advance,
    Peter Villiers

    PLEASE IGNORE THIS POST
    The problem was caused by someone (me though I honestly don't remember doing
    it), setting the content security level to high in my web browser which
    stopped this type of download.
    Peter

  • Flat file over HTTP or SOAP

    Hey Guys,
    I need to post a Flat file over HTTP (or SOAP), is this possible without developing my own Adapter module?
    I just need to get a Flat file from a FTP server and post to another server via HTTP,since there is no message mapping involved, i developed the scenario without any Integration Repository objects, it is just a pass-through scenario.
    Now i am stuck on the receiver side since i am unable to post Flat file over HTTP.
    Secondly i have Login URL, Logout URL and upload URL from the receiver system, i don't see any place in receiver HTTP adapter to put all these 3 URL's, can i use SOAP adapter to put all these URL anywhere?
    Any help would be appreciated.
    Thanks
    Saif
    Edited by: Saif Manzar on Jan 19, 2010 2:51 AM

    Hey Guys,
    I need to post a Flat file over HTTP (or SOAP), is this possible without developing my own Adapter module?
    I just need to get a Flat file from a FTP server and post to another server via HTTP,since there is no message mapping involved, i developed the scenario without any Integration Repository objects, it is just a pass-through scenario.
    Now i am stuck on the receiver side since i am unable to post Flat file over HTTP.
    Secondly i have Login URL, Logout URL and upload URL from the receiver system, i don't see any place in receiver HTTP adapter to put all these 3 URL's, can i use SOAP adapter to put all these URL anywhere?
    Any help would be appreciated.
    Thanks
    Saif
    Edited by: Saif Manzar on Jan 19, 2010 2:51 AM

  • Retreiving files over http or ftp.

    I was wondering what program I should use to retreive files over http or ftp. Previously I had used wget per my hosting provider's recommendation. It worked when I was ssh logged in to his server (via Mac Terminal). However, when I try using wget on my local Mac it says "command not found".

    Thanks. So if I specify a file name (-o /path/to/file), does the incoming file get renamed to that (and put in that location) or does this specify the directory (-o /path/to/directory) that the incoming file will go to? I wasn't quite clear on that.
    Also, I keep hearing about stdout. What is it exactly? I assumed it was just the Terminal window itself, the alternative being things like | more or | nano or something like that... Or am I totally up the wrong tree?

  • Download Text file to Local drive from BSP Application

    Hi Guys,
    I am new to BSP, and I am doing a BSP application in which i want to download a text file to local drive C: on click of button. For that I am having a data in Internal table and Onclick event, in model class method DO_HANDLE_EVENT i want to download text file to local machine drive.
    Can anybody provide me full code with all data declaration and all?
    Your help would be appriciable. Thanks in Advance.

    Hi Jessy ,
    You can download the file from BSP pages using the method
    CL_BSP_UTILITY=>download.
    Please follow the below mentioned steps.
    1.Convert the text to a text table ie Internal table with a line type char255 or some others.
    2.Convert the text table into a string.
    3.Convert the string to XSTRING.
    4.Download that XSTRING as text file using the method
       CL_BSP_UTILITY=>download.
    Parameters:
    OBJECT_S    - XSTRING data
    CONTENT_TYPE  =  ' application/download'
    CONTENT_DISPOSITION = 'attachment; file=test.txt'
    RESPONSE                   = runtime->server->response
    NAVIGATION                   = navigation
    OBJECT_T
    I dont have system to give a programatical explanation to u.
    If you have any doubt kindly post.
    Reward for every useful solutions..
    Best Regards
    Renga

  • Download text file from application server to client server.

    Hi all,
    I am facing a format issue while downloading text file from application server to the client machine.
    The issue is that, say I have 6 to 10 lines in my text file in application server. but when i store it on the hard drive,
    it shoes all the data in a single line. Where as i need to download data in same format as in application server.
    Awaiting for your responses.
    Regards,
    Jose

    Hi,
    If we want to upload file data from the application server to the internal table, there is no function module or class static method which we can use, we must wirte the code by ourselves.
    1. For the file data which has no seperator between field columns.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET p_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_data.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.2. For the file data which has tab separator between field columns.
    DATA: gds_field_split type gts_data.
    FIELD-SYMBOLS: <fs_field> TYPE gts_data.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET prf_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_field.
        SPLIT gds_field  AT cl_abap_char_utilities=>horizontal_tab
             INTO TABLE gdt_field_split.
       LOOP AT gdt_field_split  into gds_field_split.
           gdf_index = gdf_index + 1.
           ASSIGN COMPONENT gdf_index OF STRUCTURE
                 gds_data to <fs_field>.
          IF sy-subrc = 0.
              <fs_field> = gds_field_split.
          ENDIF.
       ENDLOOP.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.
    Thanks & regards,
    ShreeMohan

  • How to add a SPACE as suffix to the last field in the downloaded text file?

    Hi Experts,
    By using GUI_DOWNLOAD am saving the data(only 3 fields) in a text file on my desk top.
    fine.
    example current record1 : 010001                      354.999            26.000
    here, after 3rd field 26.000, immediately the cursor is jumping to next line in text file.
    but, wanna a SINGLE SPACE after 26.000, say 26.000+space.
    tried with CONCATENATE, OFFSETTING, but no use(may b am using incorrectly)
    so, pls. suggect me, How to add a SPACE as suffix to the last field in the downloaded text file?
    thanq

    Sorry...Typo error...Too many in the last few days -:(
    Wanted to say AFTER -:)
    Do it like this...
    FIELD1 TYPE XXX,
    FIELD2 TYPE XXX,
    FIELD3 TYPE XXX,
    SPACE(1) TYPE C,
    That way you should end with...
    26.000+SPACE
    Greetings,
    Blag.

  • How to send a text file over a LAN?

    Hi:
    I am working on a program (web app using a servlet), that produces a text file with Key / Value pairs ex) NAME
    joe
    CITY
    los angeles
    I want to send the text file over an intranet (LAN) to another pc and store it in the C:\temp directory of the receiving computer.
    Is it best to use the Networking package? Any idea on tutorials or code samples to help assist me? (I posted on Servlet Technology forum; nobody answered though...thanks for any thoughts.

    one way cud be that u write a program to open a port on the computer u want to store and make that program save on the required directory. then u can send a simple file in byte format over it. but doing this only wud b unsafe as others wud also hav the access. wat u cud do to prevent is to put some kind of password so that first u authenticate to server b4 u pass on the file.
    bye
    jods

  • Play an audio file over HTTP

    Hello everybody,
    I'm trying to play an audio file over HTTP protocol. The code is the following:
    public class HTTPClientJMF {
         static String url = "http://localhost/audio/Reklam1.wav";
         static String urlFile = "file:///C://tmp/audio/Reklam1.wav";
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              try {
                   DataSource dataS = new URLDataSource(new URL(url));
                   dataS.connect();               
                   Player player = Manager.createPlayer(dataS);
                   player.start();
              } catch (MalformedURLException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (NoPlayerException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Now, if I'm trying to play the file from the local disk (+urlFile+ - using file protocol), everything goes well, but if I'm trying to play the same file from the network (using http protocol) I get the following exception:
    javax.media.NoPlayerException: Cannot find a Player for: javax.media.protocol.URLDataSource@fa9cf
    Can somebody tell me what I'm doing wrong?
    Thank you!

    Ah',..okay. I constructed the DataSource like follows:
    Buffer mediaBuffer = new Buffer();;
              String mediaURL = "http://ares.inescn.pt/video/Reklam1.wav";
              URL url;
              try {
                   url = new URL(mediaURL );
                   InputStream in = url.openStream();
                   BufferedInputStream bufIn = new BufferedInputStream(in);
                   for (;;) {
                        int data = bufIn.read();
                        // Check for EOF
                        if (data == -1)
                             break;
                        else
                             mediaBuffer.setData(data);
                   System.out.println(mediaBuffer.getLength());
                   if (mediaBuffer.getLength() != 0) {
                        DataSource ds = new DataSource();
                        HttpStream[] httpStream = ds.getStreams();
                        System.out.println(httpStream.length);
                        httpStream[0].read(mediaBuffer);
                        ds.connect();
                        ds.start();                         
                        Player player = Manager.createPlayer(ds);
                        player.start();But I still cannot play an audio file (wav format) over the HTTP. Application starts but nothing happened.
    I make the modification like you suggested. (into the DataSource, more exactly for method getStreams()).
    I renamed as well the HttpDatasource into HttpStream.
    Did you actually tried the code? I've been reading the instruction how to test the code but I did not be able to run the example.

  • IE 9 can't download/open files from https site.

    We have application which runs in IE9 using https:\\
    IE 9 can't download/open files from https site.
    Please help....
    error1-
    Microsoft Excel - could not open 'https:\\.......\viewxlsformatshow.xls'
    error2-
    Microsoft Excel - Microsoft Excel cannot access the file 'https:\\.......\viewxlsformatshow.xls'. There are several possible reason:
        -The file name or path does not exist.
        - the file is being used by another program.
         - the workbook you are trying to save has the same  name as a currently open workbook.

    Hi,
    Have you tried to use "HTTP"?
    Have you the correct office program installed on your computer?
    Could you provide the corresponding credential to access them?
    If so, please make sure you have the proper right.
    Please let other user try to download(not open) the resource to confirm the original resource is without problem.
    After that, refer to the following article to change the settings:
    Error message when you download files by using Internet Explorer 9 from secure websites: "<filename> couldn’t be downloaded"
    http://support.microsoft.com/en-us/kb/2549423
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to download video files using http urls through OSB

    Hi all,
    I am working on a requirement where I need to download the video using http url of that video through OSB. Is it possible to convert the video files hosted in a server into base64 code using OSB ? Kindly help me on this.
    Thanks
    Edited by: 887737 on Jul 25, 2012 3:26 AM

    Hi,
    I believe you can get the video file using file transport and then convert it into base64 using a java call out...
    This may help...
    https://blogs.oracle.com/ateamsoab2b/entry/an_example_of_how_to
    Cheers,
    Vlad

Maybe you are looking for

  • Address book crashes whenever I try to open it.

    Whenever I try to open Address Book, I receive the messge, "Address Book quit unexpectedly."  Problem Details and System Configuration are then shown, with the option to click "OK" or "Reopen."  Most of the time, when I click "Reopen," I receive the

  • Will hooking up my iPhone to iTunes and "Transfer Purchases" also transfer my music?

    If I deleted all my music files, but the library still has the tracks (with the '!' symbol) and I transfer purchases, even though not all of them are purchased but ripped from CDs and such, would that restore the missing files? If it doesn't is there

  • House Cleaning (OWB)

    Hi, Currently my mappings are running fine. I just need to know some info on cleaning up my OWB audit and logs tables. My tablespace for OWB is increasing and how can i do a cleaning activity every month? Please give me some suggestion. Regards Raj

  • Migrate old keychain to new computer

    Hi all I'm preparing to buy a Mac Mini to replace my sadly moribund iBook G3. One thing that I am quite concerned about is that my keychain should be successfully migrated, since it contains crucial password information that is not stored elsewhere.

  • There is a trial still going on after I paid for the product

    So I basically did a free trial for photoshop cc and now its over. I then paid 9.99 a month for photoshop and lightroom but I never got the license number all I got was a code with numbers and letters, I tried entering that code into the license code