473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Http Compress Request

hi ,
I have a doubt .
I have a 5mb file on a server . I am downloading the file from my java application
My application is NOT a web aplication I am using https connection to the sever

My code is something like this

public static void downloadFileSSL(String fileName) {

String urlPath = "https://200.216.221.25/";
int portNumber = 443;
try {
String hostName = "172.16.1.165";
SSLSocket serSoc = new SSLSocket(hostName,portNumber);
serSoc.setNeedClientAuth(false);

System.out.println("Connection "+serSoc.isConnected());

String fileURL = "/abc/"+fileName;
OutputStream out = serSoc.getOutputStream();
String msg = "GET " + fileURL + " HTTP/1.0\r\n\r\n" ;
byte b[];
try {
b = msg.getBytes("ASCII7");
}
catch (UnsupportedEncodingException ignored) {
b = msg.getBytes();
}
out.write(b);
out.flush();

BufferedInputStream bin = new BufferedInputStream
(serSoc.getInputStream());
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
int ch = 0;
while ((ch = bin.read()) != -1) {

byteStream.write(ch);
}
byte[] dataBytes = byteStream.toByteArray();
bin.close();
byteStream.close();

// Saving into the file
String outFile = "C:\\" + fileName;
FileOutputStream fileOut = new FileOutputStream(outFile);
fileOut.write(dataBytes);
fileOut.flush();
fileOut.close();
System.out.println("File Saved Sucessfully.....:"+ fileName);

} catch (IOException e) {
System.err.println(e);
e.printStackTrace();
}
catch (MalformedURLException e) {
System.err.println(e);
e.printStackTrace();
}
}



*****************************************
This code is working fine but to download that file it take lot of time.
I came to know that we can do https compressed request of that file if that
sever supports that. My server supports that .
So how to make such type of compressed request . what type of parameters
I have to pass with the http header...

Or else if u have any other suggestion please give it
Jan 18 '07 #1
0 1156

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Manlio Perillo | last post by:
Hi. RFC 2068 (Hypertext Transfer Protocol -- HTTP/1.1), introduces 4 encoding names: identity gzip (x-gzip) compress (x-compress) deflate Unfortunately standard Python library does not...
0
by: Tony | last post by:
Hello, Any assistance would be appreciated: As the subject suggests I am trying to gunzip files using the Compress::Zlib module. The following is basically the code that I am working with: ...
1
by: PerryG | last post by:
We have a .NET 1.1 client which is sending a gzipped soap request using HttpWebRequest to an Apache server. The Apache server is using a the 'mod_deflate' server to decompress the incoming...
8
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
7
by: Konstantin Andreev | last post by:
Well known, during "CREATE TABLE" we could optionally specify "COMPRESS SYSTEM DEFAULT" and "VALUE COMPRESSION" options. The main idea about these statements is : NOT to keep on disk the values that...
0
by: Chaos | last post by:
For the Program I Am Making I Make Multiple HTTP Request to My Server. I found that using urllib2 it was pretty slow, when I activated the program and tested it it would hang from 2secs-5secs since...
6
by: Champika Nirosh | last post by:
Hi, I have two machine where I needed to have a extended TCP/IP protocol to make the link between the two machines Mean,I need to write a application that compress every data the machine send...
3
by: Benny Ng | last post by:
Dear All, Now I met some performance problems in my application. Because according to our business. The size of some web forms are larger than 1xxx MB. So it takes a long time for user opening a...
5
by: zgh1970 | last post by:
Hi, Friends, default DB2 compression library. I am wondering if this option will have any new restriction on RESTORE in the following. (Can I used that backup imsage for restore at the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.