Jakarta problem

S

slippymississippi

I have this document that I would like to send via HTTP Post. However,
the receiving application expects the content data to be sent as a
parameter... and the content data can be hundreds of megabytes large.

Does there exist an HTTP Client tool that allows you to stream the post
request, rather than loading the request into memory up front?
 
O

Oliver Wong

I have this document that I would like to send via HTTP Post. However,
the receiving application expects the content data to be sent as a
parameter... and the content data can be hundreds of megabytes large.

When you say "as a parameter", do you mean GET? If so, you may be out of
luck. I believe there's a limit on the length of an HTTP URL.

- Oliver
 
S

slippymississippi

When you say "as a parameter", do you mean GET?

No, POST. I'm assuming that Jakarta knows enough about post to bury
any huge parameter value in the body of the post, right?
 
O

Oliver Wong

No, POST. I'm assuming that Jakarta knows enough about post to bury
any huge parameter value in the body of the post, right?

Okay, so when you say "I have this document that I would like to send
via HTTP Post. However, the receiving application expects the content data
to be sent as a parameter", why the "however"? What's preventing you from
simply using POST?

- Oliver
 
S

slippymississippi

What's preventing you from simply using POST?

"... the content data can be hundreds of megabytes large."

This is going to be a threaded application handling multiple requests,
I don't think loading up Java String objects with several hundred
megabytes, and passing them into a PostMethod object using Jakarta's
addParameter method is going to fly.
 
O

Oliver Wong

"... the content data can be hundreds of megabytes large."

This is going to be a threaded application handling multiple requests,
I don't think loading up Java String objects with several hundred
megabytes, and passing them into a PostMethod object using Jakarta's
addParameter method is going to fly.

I looked all over http://jakarta.apache.org/httpcomponents/index.html
and couldn't find an API reference, so I don't know what's available to you.
If I were doing this, I'd do it manually, forming the HTTP request header,
sending it to the socket, then maybe read 1024 bytes a at time from the
file, send that through the socket, read another 1024 bytes, send it, and so
on.

If Jakarta really "forces" you pre-load the entire file in memory, and
if that goes against your requirements, I guess you have no choice but to
dump Jakarta; at least for this particular feature.

- Oliver
 
S

slippymississippi

I looked all over

Yeah, I thought it was kinda wacky that they hide the javadocs from
you. You have to drill down into the developer's section to get to the
javadocs, IIRC.

Thanks!
 
O

Oliver Wong

Roedy Green said:

Thanks. I see now the API for PostMethod, and its insistence of
receiving pairs of strings as ("name","value) pairs that Slippy was
complaining about.

I took a look at the code at
http://svn.apache.org/repos/asf/jak...g/apache/http/examples/ElementalHttpPost.java
to see how they did things differently, and it looks like they are using the
org.apache.http.message.HttpPost and org.apache.http.HttpEntity classes
which don't see to be covered by the "org.apache.commons.httpclient" set of
javadocs.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top