Re: UrlEncodedFormEntity throws OutOfMemoryError exception

2010-01-21 Thread Oleg Kalnichevski
On Wed, 2010-01-20 at 08:54 -0800, nabbler101 wrote:
 So I'm trying to pass a very large string (~15mb) as a parameter using
 httppost but I'm getting an OutOfMemoryException.  The heap size is set to
 512-1024mb (which should be more than enough.)
 
 Is there a way around this problem?  I'd appreciate any help.  
 

What is the point of buffering 15mb of data in memory? Have you
considered NOT buffering content of the file in memory?

Oleg


-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Re: UrlEncodedFormEntity throws OutOfMemoryError exception

2010-01-21 Thread David Motes
Use FileBody in the MultipartEntity.

See MultipartEntity discussion in this post:
http://old.nabble.com/HttpClient-3.1-to-4.0-migration-td25262394.html

On Thu, Jan 21, 2010 at 8:14 AM, nabbler101 bghorb...@gmail.com wrote:

 Yes I've tried MultipartEntity.  That works fine.  But I want to send two
 text parameters a 3rd parameter as a file.

 Lets say A and B are the two text parameters

 nvps.add(new BasicNameValuePair(A, 1));
 nvps.add(new BasicNameValuePair(B, 2));

 But C is a file...a text file at that.

 nvps.add(new BasicNameValuePair(C, big text file));

 Now I know that's not a good idea, but what is the correct way of doing
 this?

 Thanks!



 olegk wrote:

 On Wed, 2010-01-20 at 08:54 -0800, nabbler101 wrote:
 So I'm trying to pass a very large string (~15mb) as a parameter using
 httppost but I'm getting an OutOfMemoryException.  The heap size is set
 to
 512-1024mb (which should be more than enough.)

 Is there a way around this problem?  I'd appreciate any help.


 What is the point of buffering 15mb of data in memory? Have you
 considered NOT buffering content of the file in memory?

 Oleg


 -
 To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
 For additional commands, e-mail: httpclient-users-h...@hc.apache.org




 --
 View this message in context: 
 http://old.nabble.com/UrlEncodedFormEntity-throws-OutOfMemoryError-exception-tp27244948p27257481.html
 Sent from the HttpClient-User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
 For additional commands, e-mail: httpclient-users-h...@hc.apache.org



-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



apache commons HttpClient Base64 encoding of multibyte characters issue

2010-01-21 Thread Usha_N

Hello,

We are using apache commons HttpClient library (commons-httpclient-3.1.jar). 

Users are providing username and password that has multibyte characters in
it. Base64 encoding of the mutlitbyte characters in HttpClient doesn’t seem
to be working.


Below API’s are used:

  Credentials credents = new
UsernamePasswordCredentials(userId, password);
  m_httpState.setCredentials(realm, m_host, credents);

m_httpClient.executeMethod(m_hostConf,httpmethod,m_httpState);

I have a text 

test1:测试组:Designer:test1

Capturing the network trace from the client that uses the above jar (note:
the authorization header):
HEAD /tc/FileAccess/ HTTP/1.1
User-Agent: DAKCLIENT/7.0
Accept-Language: zh-CN
Authorization: Basic dGVzdDE6Pz8/OkRlc2lnbmVyOnRlc3Qx
Host: ahi6w033:


Using the online Base64 decoder utility
(http://www.opinionatedgeek.com/dotnet/tools/Base64Decode/Default.aspx) ,
passing dGVzdDE6Pz8/OkRlc2lnbmVyOnRlc3Qx results the decoding to be
test1:???:Designer:test1 (note: ???)

Using the online encoder utility: test1:测试组:Designer:test1  gets Base64
encoded as  :
 dGVzdDE65rWL6K+V57uEOkRlc2lnbmVyOnRlc3Qx

This makes me believe that Base64 encodign in common’s apache isn’t working
correctly.

Please help and advice.

Thanks..
Usha

-- 
View this message in context: 
http://old.nabble.com/apache-commons-HttpClient-Base64-encoding-of-multibyte-characters-issue-tp27263367p27263367.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Re: apache commons HttpClient Base64 encoding of multibyte characters issue

2010-01-21 Thread sebb
On 21/01/2010, Usha_N usha.na...@siemens.com wrote:

  Hello,

  We are using apache commons HttpClient library (commons-httpclient-3.1.jar).

  Users are providing username and password that has multibyte characters in
  it. Base64 encoding of the mutlitbyte characters in HttpClient doesn’t seem
  to be working.


  Below API’s are used:

   Credentials credents = new
  UsernamePasswordCredentials(userId, password);
   m_httpState.setCredentials(realm, m_host, credents);

  m_httpClient.executeMethod(m_hostConf,httpmethod,m_httpState);

  I have a text

  test1:测试组:Designer:test1

  Capturing the network trace from the client that uses the above jar (note:
  the authorization header):
  HEAD /tc/FileAccess/ HTTP/1.1
  User-Agent: DAKCLIENT/7.0
  Accept-Language: zh-CN
  Authorization: Basic dGVzdDE6Pz8/OkRlc2lnbmVyOnRlc3Qx
  Host: ahi6w033:


  Using the online Base64 decoder utility
  (http://www.opinionatedgeek.com/dotnet/tools/Base64Decode/Default.aspx) ,
  passing dGVzdDE6Pz8/OkRlc2lnbmVyOnRlc3Qx results the decoding to be
  test1:???:Designer:test1 (note: ???)

  Using the online encoder utility: test1:测试组:Designer:test1  gets Base64
  encoded as  :
   dGVzdDE65rWL6K+V57uEOkRlc2lnbmVyOnRlc3Qx

  This makes me believe that Base64 encodign in common’s apache isn’t working
  correctly.

  Please help and advice.

AIUI, HTTP Basic Authentication does not support any character set
apart from the default ISO-8859-1.

  Thanks..
  Usha


  --
  View this message in context: 
 http://old.nabble.com/apache-commons-HttpClient-Base64-encoding-of-multibyte-characters-issue-tp27263367p27263367.html
  Sent from the HttpClient-User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
  For additional commands, e-mail: httpclient-users-h...@hc.apache.org



-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org