RE: Way to send p12 file with post payload in httpclient 4.5.4

2019-09-26 Thread Khare, Aparna
Thanks it worked

-Original Message-
From: Bernd Eckenfels  
Sent: Thursday, September 26, 2019 12:45 PM
To: HttpClient User Discussion 
Subject: Re: Way to send p12 file with post payload in httpclient 4.5.4

Maybe using a ByteArrayBody or FileBody should help, since the InputStream can 
be consumed only once.

Gruss
Bernd


--
http://bernd.eckenfels.net


Von: Khare, Aparna 
Gesendet: Donnerstag, September 26, 2019 9:03 AM
An: HttpClient User Discussion
Betreff: Way to send p12 file with post payload in httpclient 4.5.4

Dear All,

Im using the below httpclient code to send the pk12 file
Input stream is the stream obtained after reading pk12 file the same file is to 
be send to another endpoint
MultipartEntity entity = new MultipartEntity();
entity.addPart("file", new InputStreamBody(inputStream2, "test.p12"));
Destination destination = getDestination(destinationName);
HttpClient httpClient = destination.createHttpClient();
HttpPost httpPost = getHttpPost(destination, endPoint);
httpPost.setEntity(entity);
response = httpClient.execute(httpPost);

However we are always getting

cannot-retry-request-with-a-non-repeatable-request-entity

Any Idea please help

Thanks,
Aparna

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



Way to send p12 file with post payload in httpclient 4.5.4

2019-09-26 Thread Khare, Aparna
Dear All,

Im using the below httpclient code to send the pk12 file
Input stream is the stream obtained after reading pk12 file the same file is to 
be send to another endpoint
  MultipartEntity entity = new MultipartEntity();
  entity.addPart("file", new InputStreamBody(inputStream2, "test.p12"));
  Destination destination = getDestination(destinationName);
  HttpClient httpClient = destination.createHttpClient();
  HttpPost httpPost = getHttpPost(destination, endPoint);
  httpPost.setEntity(entity);
  response = httpClient.execute(httpPost);

However we are always getting

cannot-retry-request-with-a-non-repeatable-request-entity

Any Idea please help

Thanks,
Aparna


NoHttpResponseException in httpclient 4.5.4

2019-08-06 Thread Khare, Aparna
We are using httpclient 4.5.4 and httpcore 4.4.9

We are getting this error .. Any idea would help

org.apache.http.NoHttpResponseException: saaa:443 failed to respond at 
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
 at 
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
 at 
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
 at 
org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
 at 
org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165) 
at 
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
 at 
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
 at 
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) 
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) 
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at 
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) at 
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
 at

Thanks,
Aparna


RE: Issue with deflate Content-Encode httpClient 4.1.3

2018-12-20 Thread Khare, Aparna
Hi Oleg,

 Actually we cannot move from HttpClient 4.1.3 can we get this fixed here ...or 
if there is a workaround..

Thanks,
Aparna

-Original Message-
From: Oleg Kalnichevski  
Sent: Thursday, December 20, 2018 3:18 PM
To: Khare, Aparna ; HttpClient User Discussion 

Subject: Re: Issue with deflate Content-Encode httpClient 4.1.3

On Thu, 2018-12-20 at 08:20 +, Khare, Aparna wrote:
> Hi Oleg,
> 
>https://httpbin.davecheney.com/deflate
> 
> I'm trying to do an GET  the response for the above url.
> 
> if (response.getEntity() != null) {
> InputStream  inStream = response.getEntity().getContent();
> 
> if (inStream != null) {
>   try {
> ByteArrayOutputStream outStream = new
> ByteArrayOutputStream();
> int value = inStream.read();
> while (value != -1) {
>   outStream.write(value);
>   value = inStream.read();
> }
> response = outStream.toByteArray();
>   } 
> }
> Finally this data is required to be parsed on UI where we are using
> 
> Both deflated content and gZip data is malformed once the response is
> returned ..(Encoding issue)
> 
> How can I get this fixed. 
> 
> Thanks,
> Aparna
> 

Works with HttpClient 4.5

Oleg

[DEBUG] RequestAddCookies - CookieSpec selected: default
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: 
{s}->https://httpbin.davecheney.com:443][total kept alive: 0; route allocated: 
0 of 2; total allocated: 0 of 20]
[DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: 
{s}->https://httpbin.davecheney.com:443][total kept alive: 0; route allocated: 
1 of 2; total allocated: 1 of 20]
[DEBUG] MainClientExec - Opening connection 
{s}->https://httpbin.davecheney.com:443
[DEBUG] DefaultHttpClientConnectionOperator - Connecting to 
httpbin.davecheney.com/35.189.26.87:443
[DEBUG] SSLConnectionSocketFactory - Connecting socket to 
httpbin.davecheney.com/35.189.26.87:443 with timeout 0
[DEBUG] SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, 
TLSv1.2]
[DEBUG] SSLConnectionSocketFactory - Enabled cipher 
suites:[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, 
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, 
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, 
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, 
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, 
TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, 
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, 
TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, 
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, 
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, 
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, 
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, 
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 
TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 
TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, 
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, 
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 
TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, 
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, 
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
[DEBUG] SSLConnectionSocketFactory - Starting handshake
[DEBUG] SSLConnectionSocketFactory - Secure session established
[DEBUG] SSLConnectionSocketFactory -  negotiated protocol: TLSv1.2
[DEBUG] SSLConnectionSocketFactory -  negotiated cipher suite: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[DEBUG] SSLConnectionSocketFactory -  peer principal: CN=httpbin.davecheney.com
[DEBUG] SSLConnectionSocketFactory -  peer alternative names: 
[httpbin.davecheney.com]
[DEBUG] SSLConnectionSocketFactory -  issuer principal: CN=Let's Encrypt 
Authority X3, O=Let's Encrypt, C=US
[DEBUG] DefaultHttpClientConnectionOperator - Connection established 
192.168.43.142:57358<->35.189.26.87:443
[DEBUG] MainClientExec - Executing request GET /deflate HTTP/1.1
[DEBUG] MainClientExec - Target auth state: UNCHALLENGED
[DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
[DEBUG] headers - http-outgoing-0 >> GET /deflate HTTP/1.1
[DEBUG] headers - http-outgoing-0 >> Host: httpbin.davecheney.com
[DEBUG] headers - http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] headers - http-outgoing-0 >> User-Agent: Apach

RE: Issue with deflate Content-Encode httpClient 4.1.3

2018-12-20 Thread Khare, Aparna
Hi Oleg,

   https://httpbin.davecheney.com/deflate

I'm trying to do an GET  the response for the above url.

if (response.getEntity() != null) {
InputStream  inStream = response.getEntity().getContent();

if (inStream != null) {
  try {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
int value = inStream.read();
while (value != -1) {
  outStream.write(value);
  value = inStream.read();
}
response = outStream.toByteArray();
  } 
}
Finally this data is required to be parsed on UI where we are using

Both deflated content and gZip data is malformed once the response is returned 
..(Encoding issue)

How can I get this fixed. 

Thanks,
Aparna





}




-Original Message-
From: Oleg Kalnichevski  
Sent: Wednesday, December 19, 2018 7:15 PM
To: HttpClient User Discussion 
Subject: Re: Issue with deflate Content-Encode httpClient 4.1.3

On Wed, 2018-12-19 at 13:39 +, Khare, Aparna wrote:
> Thank Oleg but if that is the case do I still need to send type cast
> to GzipDecompressingEntity..without casting to
> GzipDecompressingEntity Im not getting byte[] some encoding issue
> with the response content
> 
> 
> 
> I have seen that when I get the response content as InputStream and
> convert it to
> 
> 
> 
> try {
> 
> ByteArrayOutputStream outStream = new
> ByteArrayOutputStream();
> 
> int value = inStream.read();
> 
> while (value != -1) {
> 
>   outStream.write(value);
> 
>   value = inStream.read();
> 
> }
> 
> response = outStream.toByteArray();
> 
> 
> 
> }
> 
> 
> 
> It is not sending the byte[] properly..
> 
> 

I am sorry I do not understand.

Oleg


> 
> -Original Message-
> From: Oleg Kalnichevski 
> Sent: Wednesday, December 19, 2018 3:47 PM
> To: HttpClient User Discussion 
> Subject: Re: Issue with deflate Content-Encode httpClient 4.1.3
> 
> 
> 
> On Wed, 2018-12-19 at 07:41 +, Khare, Aparna wrote:
> 
> > Dear All,
> > 
> > We have some constraints in moving to new httpclient and we are
> > using
> > 4.1.3. Any help is appreciated. gzipContent works but deflated is
> > not
> > working.
> > 
> > if (response.getEntity() != null) {
> >  HttpEntity entity = response.getEntity();
> >   Header contentEncodingHeader =
> > entity.getContentEncoding();
> > 
> >  if (contentEncodingHeader != null) {
> >   HeaderElement[] encodings
> > =contentEncodingHeader.getElements();
> >   for (int i = 0; i < encodings.length; i++) {
> >   if
> > (encodings[i].getName().equalsIgnoreCase("gzip")) {
> >   entity = new GzipDecompressingEntity(entity);
> >   break;
> >   } else
> > if(encodings[i].getName().equalsIgnoreCase("deflate")) {
> >   entity = new
> > DeflateDecompressingEntity(entity);
> >   break;
> >   }
> >   }
> >   }
> > 
> > And we use the below mechanism to set the params in the httpclient
> > ..
> > I have read that I need to disable the compressions. But I could
> > not
> > find how can I set that..
> > 
> 
> 
> 
> HttpClient 4.1 does not support automatic content decompression. You
> do
> 
> not need to disable it.
> 
> 
> 
> Oleg
> 
> 
> 
> 
> 
> > rsClient = new DefaultHttpClient();
> > rsClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
> > TESTCONSOLE);
> > rsClient.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS
> > ,
> > false);
> > 
> > Thanks,
> > Aparna
> > 
> 
> 
> 
> 
> 
> -
> 
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org ilto:httpclient-users-unsubscr...@hc.apache.org>
> 
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org<
> mailto: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



RE: Issue with deflate Content-Encode httpClient 4.1.3

2018-12-19 Thread Khare, Aparna
Thank Oleg but if that is the case do I still need to send type cast to 
GzipDecompressingEntity..without casting to GzipDecompressingEntity Im not 
getting byte[] some encoding issue with the response content



I have seen that when I get the response content as InputStream and convert it 
to



try {

ByteArrayOutputStream outStream = new ByteArrayOutputStream();

int value = inStream.read();

while (value != -1) {

  outStream.write(value);

  value = inStream.read();

}

response = outStream.toByteArray();



}



It is not sending the byte[] properly..



-Original Message-
From: Oleg Kalnichevski 
Sent: Wednesday, December 19, 2018 3:47 PM
To: HttpClient User Discussion 
Subject: Re: Issue with deflate Content-Encode httpClient 4.1.3



On Wed, 2018-12-19 at 07:41 +, Khare, Aparna wrote:

> Dear All,

>

> We have some constraints in moving to new httpclient and we are using

> 4.1.3. Any help is appreciated. gzipContent works but deflated is not

> working.

>

> if (response.getEntity() != null) {

>  HttpEntity entity = response.getEntity();

>   Header contentEncodingHeader = entity.getContentEncoding();

>

>  if (contentEncodingHeader != null) {

>   HeaderElement[] encodings

> =contentEncodingHeader.getElements();

>   for (int i = 0; i < encodings.length; i++) {

>   if

> (encodings[i].getName().equalsIgnoreCase("gzip")) {

>   entity = new GzipDecompressingEntity(entity);

>   break;

>   } else

> if(encodings[i].getName().equalsIgnoreCase("deflate")) {

>   entity = new

> DeflateDecompressingEntity(entity);

>   break;

>   }

>   }

>   }

>

> And we use the below mechanism to set the params in the httpclient ..

> I have read that I need to disable the compressions. But I could not

> find how can I set that..

>



HttpClient 4.1 does not support automatic content decompression. You do

not need to disable it.



Oleg





> rsClient = new DefaultHttpClient();

> rsClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,

> TESTCONSOLE);

> rsClient.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS,

> false);

>

> Thanks,

> Aparna

>





-

To unsubscribe, e-mail: 
httpclient-users-unsubscr...@hc.apache.org<mailto:httpclient-users-unsubscr...@hc.apache.org>

For additional commands, e-mail: 
httpclient-users-h...@hc.apache.org<mailto:httpclient-users-h...@hc.apache.org>




Issue with deflate Content-Encode httpClient 4.1.3

2018-12-18 Thread Khare, Aparna
Dear All,

We have some constraints in moving to new httpclient and we are using 4.1.3. 
Any help is appreciated. gzipContent works but deflated is not working.

if (response.getEntity() != null) {
 HttpEntity entity = response.getEntity();
  Header contentEncodingHeader = entity.getContentEncoding();

 if (contentEncodingHeader != null) {
  HeaderElement[] encodings =contentEncodingHeader.getElements();
  for (int i = 0; i < encodings.length; i++) {
  if (encodings[i].getName().equalsIgnoreCase("gzip")) {
  entity = new GzipDecompressingEntity(entity);
  break;
  } else if(encodings[i].getName().equalsIgnoreCase("deflate")) 
{
  entity = new DeflateDecompressingEntity(entity);
  break;
  }
  }
  }

And we use the below mechanism to set the params in the httpclient .. I have 
read that I need to disable the compressions. But I could not find how can I 
set that..

rsClient = new DefaultHttpClient();
rsClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, TESTCONSOLE);
rsClient.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, false);

Thanks,
Aparna



Redirection in httpClient

2018-06-25 Thread Khare, Aparna
Hi All,

  We have moved our application to version 4.5.2 and we want to check how we 
can configure our httpclient to handle redirection ..

We connect to the proxy agent which takes only http calls. The redirected URL 
is https how can we enable the redirection only make an connection( HTTP proxy 
).

Can we make redirectionStrategy to only make HTTP call even the call is https..

Thanks,
Aparna


Async httpclient with SOCKS5 proxy

2018-05-17 Thread Khare, Aparna
Dear Users,

   Can you please help me with the examples to configure Async HttpClient with 
SOCKS5 proxy..

I read that the same is not supported for Async httpclient..

Thanks,
Aparna


RE: Versions and osgi and async and such

2018-04-12 Thread Khare, Aparna
Hi,

  We tried and we are able to get our bundle up with the dependency of the 
httpclient async.. This is not an OSGI but via writing to the bundle classpath 
from pom.

4.4
4.5.4
4.1.3
1.2
2.4


org.apache.httpcomponents
httpasyncclient
${asyncclient.version}


org.apache.httpcomponents
httpcore
${httpcore.version}


org.apache.httpcomponents
httpcore-nio
${httpcore.version}


org.apache.httpcomponents
httpclient
${httpclient.version}


commons-logging
commons-logging
${commons-logging.version}




But when I run my service I'm getting  

java.lang.NoSuchMethodError: 
org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.(Lorg/apache/http/impl/nio/reactor/IOReactorConfig;Ljava/util/concurrent/ThreadFactory;)V

org.apache.http.impl.nio.client.IOReactorUtils.create(IOReactorUtils.java:43)

org.apache.http.impl.nio.client.HttpAsyncClientBuilder.build(HttpAsyncClientBuilder.java:666)

org.apache.http.impl.nio.client.HttpAsyncClients.createDefault(HttpAsyncClients.java:60)

I tried moving to the different version of httpcore.. It still does not work.

Can some please help here


-Original Message-
From: Oleg Kalnichevski [mailto:ol...@apache.org] 
Sent: Tuesday, April 10, 2018 6:22 PM
To: HttpClient User Discussion <httpclient-users@hc.apache.org>
Subject: Re: Versions and osgi and async and such

On Tue, 2018-04-10 at 09:53 +, Khare, Aparna wrote:
> Hi All ,
> 
>    We are also trying to use the lastest HTTPClient 4.5.5 with Asycn
> Httpclient ..
> 
> When we try to bundle the latest Async HttpClient we are not able to
> start the application because of missing dependency.. we need to find
> the relevant OSGI jars httpclient-cache-4.5.3 etc  which we could
> bundle
> 
> Can someone guide here ...
> 
> Thanks,
> Aparma

Aparma

You need to latest version of HttpCore 4.4.x OSGi bundle and HttpClient
4.5.x OSGi bundle.

http://hc.apache.org/downloads.cgi

Oleg.



> 
> -Original Message-
> From: Benson Margulies [mailto:bimargul...@gmail.com] 
> Sent: Wednesday, September 14, 2016 5:44 PM
> To: HttpClient User Discussion <httpclient-users@hc.apache.org>
> Subject: Versions and osgi and async and such
> 
> I am struggling to maintain some code that wants to use the latest
> 4.x
> version of http asynchronous client via OSGi.
> 
> The latest async client is 4.1.2. I've had this working, but a small
> change
> has put me in a state where various things implode, so I'm trying to
> start
> over from first principles.
> 
> When I use that as a dependency, I end up with ...
> 
> 
> java.lang.NoSuchMethodError:
> org.apache.http.util.Asserts.check(ZLjava/lang/String;Ljava/lang/Obje
> ct;)V
> at
> org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.ensureRu
> nning(CloseableHttpAsyncClientBase.java:90)
> at
> org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(Inter
> nalHttpAsyncClient.java:123)
> at
> org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(Clos
> eableHttpAsyncClient.java:75)
> at
> org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(Clos
> eableHttpAsyncClient.java:108)
> at
> org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(Clos
> eableHttpAsyncClient.java:92)
> 
> -
> 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



RE: Versions and osgi and async and such

2018-04-10 Thread Khare, Aparna
Hi All ,

   We are also trying to use the lastest HTTPClient 4.5.5 with Asycn Httpclient 
..

When we try to bundle the latest Async HttpClient we are not able to start the 
application because of missing dependency.. we need to find the relevant OSGI 
jars httpclient-cache-4.5.3 etc  which we could bundle

Can someone guide here ...

Thanks,
Aparma

-Original Message-
From: Benson Margulies [mailto:bimargul...@gmail.com] 
Sent: Wednesday, September 14, 2016 5:44 PM
To: HttpClient User Discussion 
Subject: Versions and osgi and async and such

I am struggling to maintain some code that wants to use the latest 4.x
version of http asynchronous client via OSGi.

The latest async client is 4.1.2. I've had this working, but a small change
has put me in a state where various things implode, so I'm trying to start
over from first principles.

When I use that as a dependency, I end up with ...


java.lang.NoSuchMethodError:
org.apache.http.util.Asserts.check(ZLjava/lang/String;Ljava/lang/Object;)V
at
org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.ensureRunning(CloseableHttpAsyncClientBase.java:90)
at
org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:123)
at
org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:75)
at
org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:108)
at
org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:92)


How to implement httpPatch in httpCLient 4.1.3

2017-02-20 Thread Khare, Aparna
Dear Users,

  I have a requirement where I want to implement HTTPPatch method. The problem 
is we are still on httpClient 4.1.3 which does not have a default method for 
PATCH.

I need help if there are ways I can do the same.

Looking forward to the experts.

Thanks,
Aparna

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



HttpClient 4.1.3 Peer not verified

2016-09-01 Thread Khare, Aparna
Hi All,

  I'm using httpclien-4.1.3 and I get the below issue.

I have used trust all mode
Below is the code


SSLContext sslContext;
try {
  sslContext = SSLContext.getInstance("SSL");
  TrustManager[] trustAllTrustManagers = new TrustManager[] { new 
javax.net.ssl.X509TrustManager() {
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
  return null;
}

@Override
public void checkClientTrusted(final X509Certificate[] certs, final 
String authType) {
}

@Override
public void checkServerTrusted(final X509Certificate[] certs, final 
String authType) {
}

  } };

  sslContext.init(null, trustAllTrustManagers, new 
java.security.SecureRandom());
  SSLSocketFactory sslSocketFactory = new SSLSocketFactory(sslContext);
  Scheme sch = new Scheme("https", HTTP, sslSocketFactory);
  client.getConnectionManager().getSchemeRegistry().register(sch);


I get the below error
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

Please guide

Thanks,
Aparna



RE: EntityUtils.ToString() is too slow

2016-07-23 Thread Khare, Aparna
Hi Bernd,

  The response is big which I get from the server  5MB it’s a json response 
.The chartset is UTF-8.
Also the time taken to read response is around 7 seconds .

Can you tell me how can I check first and last byte.

I need to improve the for reading the response and then later I have parse the 
json response.
Any suggestion and help would be great

Thanks,
aparna

From: e...@zusammenkunft.net [mailto:e...@zusammenkunft.net]
Sent: Friday, July 22, 2016 11:39 PM
To: Khare, Aparna <aparna.kh...@sap.com>; httpclient-users@hc.apache.org
Subject: AW: EntityUtils.ToString() is too slow

You need to provide more info, how big is the response, what charset, how long 
does the server take to provide the first and last byte? I would suspect the 
server takes 4,832s.


Gruss
Bernd
--
http://bernd.eckenfels.net
From Win 10 Mobile

Von: Khare, Aparna<mailto:aparna.kh...@sap.com>
Gesendet: Freitag, 22. Juli 2016 14:54
An: httpclient-users@hc.apache.org<mailto:httpclient-users@hc.apache.org>
Betreff: EntityUtils.ToString() is too slow

Dear All,

   I'm trying to use EntityUtils.toString(responseEntity, 
RuntimeAdapterConstants.UTF_8)

Where responseEntity is string to read the json response this is taking around 
5 seconds.

Can you please help how I can improve the turnaround time or use some other api

Thanks,
Aparna



EntityUtils.ToString() is too slow

2016-07-22 Thread Khare, Aparna
Dear All,

   I'm trying to use EntityUtils.toString(responseEntity, 
RuntimeAdapterConstants.UTF_8)

Where responseEntity is string to read the json response this is taking around 
5 seconds.

Can you please help how I can improve the turnaround time or use some other api

Thanks,
Aparna


Issue with httpClint 4.1.3 using the same httpClient instance gets stuck

2016-05-24 Thread Khare, Aparna
Dear Colleagues,

  Can anyone help with this.

I want to resuse the same httpClient instance in my application,

The problem is after the second httpClient Execute the request hangs to solve 
this I did the following configuration to my httpClient

httpClient.getParams().setParameter("http.connection-manager.max-total",10);
 httpClient.getParams().setParameter("http.connection-manager.timeout",0);
  httpClient.getParams().setParameter("http.socket.timeout", new 
Integer(5));

But still I get the ConnectionShutDown error

I have read somewhere that the httpClient can execute only to requests by 
default.In my application I extensively use the httpClient.

Thanks,
Aparna




Issues with parsing httpClient cookie for XSRF handling

2016-05-09 Thread Khare, Aparna
Dear Colleagues,

   I have a service which does CSRF protection for POST and PUT method when I 
Do GET
I should first fetch the xsrf token passing fetch header with that I get the 
client cookies and the same cookies should be sent

I get the XSRF as well as cookies but somehow the token is giving CSRF 
Validation failed looks like an issue with cookie handling

Snippet of my code is as below

private CookieStore getCookieStore() {
HttpServletRequest req = getHttpServletRequest();
Object cs = req.getSession().getAttribute("m");
if (cs == null) {
  cs = new BasicCookieStore();
  req.getSession().setAttribute("", cs);
  }
  return (CookieStore) cs;
}
  private HttpServletRequest getHttpServletRequest() {
return (HttpServletRequest) getContext().
  getParameter(context.HTTP_SERVLET_REQUEST_OBJECT);
  }


  private void putCookieStore(CookieStore cs) {
  getHttpServletRequest().getSession().setAttribute("mmm", cs);
}

Initialization of http client
DefaultHttpClient rsClient = new DefaultHttpClient();
setTrustAll(rsClient);
rsClient.setCookieStore(cs);

What can be the issue can someone please help

Thanks,
Aparna