List Info

Thread: Hi ... httpclient for PDF files ???




Hi ... httpclient for PDF files ???
user name
2006-03-27 21:11:31
Hi ..

I am using httpclient for a few hours ... I have just
downloaded the jar
3.0over the weekend!

I tried to retrieve a remote pdf file, but the inputstream
doesn't give me
the properly formatted original file!

Would httpclient support the pdfs? If so, is there anything
I need to
configure further to see the original pdf ??

Thanks!
Vijay.
Hi ... httpclient for PDF files ???
user name
2006-03-28 07:27:04
Vijay,

HttpClient is completely content agnostic. You can use it to
transfer 
arbitrary data, including PDFs.

Ortwin Glück

Vijay Gomatam wrote:
> Hi ..
> 
> I am using httpclient for a few hours ... I have just
downloaded the jar
> 3.0over the weekend!
> 
> I tried to retrieve a remote pdf file, but the
inputstream doesn't give me
> the properly formatted original file!
> 
> Would httpclient support the pdfs? If so, is there
anything I need to
> configure further to see the original pdf ??
> 
> Thanks!
> Vijay.
> 

-- 
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5
81CF 3416

------------------------------------------------------------
---------
To unsubscribe, e-mail: httpclient-dev-unsubscribejakarta.apache.org
For additional commands, e-mail: httpclient-dev-helpjakarta.apache.org

Hi ... httpclient for PDF files ???
user name
2006-03-28 16:04:10
Hi Ortwin,

Thanks for the reply... I tried to get the InputStream and
put it to a
fileoutputstream and look into the file! I see the new file
which is a few
KB lesser than the original file !!

For a clearer pic , I am attaching a code snippet! Is this a
right approach?

// -----
HttpClient httpClient=*new* HttpClient();

httpClient.setConnectionTimeout(_connectionCreateTimeout);

httpClient.setTimeout(_connectionReadTimeout);

postMethod=*new* PostMethod(url);

postMethod.setFollowRedirects(*false*);

httpClient.executeMethod(postMethod);

InputStream responseBodyStream =
postMethod.getResponseBodyAsStream();

DataInputStream data = new DataInputStream(new
BufferedInputStream(responseBodyStream));

FileOutputStream fos = new
FileOutputStream("rwservlet.pdf");

*while* ((c =data.read(b)) != -1){

*byte*[] inter=*new* *byte*[c];

*for*(*int* i=0;i<c;i++)  inter[i]=b[i];

fos.write(inter);

}

data.close();

// -----

Thanks a ton ...
Regards,
Vijay.


On 3/28/06, Ortwin Glück <odiodi.ch> wrote:
>
> Vijay,
>
> HttpClient is completely content agnostic. You can use
it to transfer
> arbitrary data, including PDFs.
>
> Ortwin Glück
>
> Vijay Gomatam wrote:
> > Hi ..
> >
> > I am using httpclient for a few hours ... I have
just downloaded the jar
> > 3.0over the weekend!
> >
> > I tried to retrieve a remote pdf file, but the
inputstream doesn't give
> me
> > the properly formatted original file!
> >
> > Would httpclient support the pdfs? If so, is there
anything I need to
> > configure further to see the original pdf ??
> >
> > Thanks!
> > Vijay.
> >
>
> --
> [web]  http://www.odi.ch/
> [blog] http://www.odi.ch/weblog/
> [pgp]  key 0x81CF3416
>        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE
70F5 81CF 3416
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: httpclient-dev-unsubscribejakarta.apache.org
> For additional commands, e-mail:
httpclient-dev-helpjakarta.apache.org
>
>
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )