Re: putRequest outputStream

2016-02-22 Thread pavel
Hi, Oleg.

I find can upload data if return from:
@Override
public long getContentLength() {
return -1;
} 
some data length, instead of -1. Now I find walk around, though I think will
use HttpClient further and logging option will be useful.

Thanks.



--
View this message in context: 
http://httpcomponents.10934.n7.nabble.com/putRequest-outputStream-tp27956p27963.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



putRequest outputStream

2016-02-21 Thread pavel
Hello

I am new with CloseableHttpClient and HttpPut and want to use them, because
with java core HttpUrlConnection class I have to fully populate OutputStream
with data, before it starts transfer to server. While my data to send size
is big, this is not fits my need, because takes too much RAM. Data
collection speed much less than upload speed to server, where I want to PUT
data, so I want to use HttpPut with output stream. I was able to swithch
from Java core class and make PUT request with CloseableHttpClient and
HttpPut but only with short String data by ByteArrayEntity. When I try to
PUT with OutputStream, I get no errors/exceptions, but data entity not
transferred. After run I see on target server updated file, with zero
length. My network Interface traffic very small and looks like no entity
data transferred. Here my custom AbstractHttpEntity:

AbstractHttpEntity entity = new  AbstractHttpEntity() {

@Override
public void writeTo(OutputStream outstream) throws 
IOException {
for (Integer i=0; i<500; i++){
String dataString = i+" data string.";

outstream.write(dataString.getBytes(Charset.forName("UTF-8")));
}
}

@Override
public boolean isStreaming() {
return true;
}

@Override
public boolean isRepeatable() {
return true;
}

@Override
public long getContentLength() {
return -1;
}

@Override
public InputStream getContent() throws IOException,
UnsupportedOperationException {
throw new UnsupportedOperationException();
//return null;
}
};  

In debugger I see writeTo method call and in loop writes to outstream. I
also played a bit with expect continue, like:

HttpPut putRequest = new HttpPut(url.toString());
RequestConfig defaultRequestConfig =
RequestConfig.custom().setExpectContinueEnabled(true).build();
putRequest.setConfig(defaultRequestConfig);

or 

putRequest.addHeader(HTTP.EXPECT_DIRECTIVE, 
HTTP.EXPECT_CONTINUE);

But this not helps. Here also my dependencies:


org.apache.httpcomponents
httpclient
4.5.1


org.apache.httpcomponents
httpcore
4.4.4


Please help how to figure this out. Everything looks like works, but
actually data not transfer.



--
View this message in context: 
http://httpcomponents.10934.n7.nabble.com/putRequest-outputStream-tp27956.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: Websocket support??

2015-05-09 Thread Pavel Bucek

Hi Oleg,

would you at least consider generic support for HTTP UPGRADE? WebSocket 
can be build on top of that and does not necessary need to be part of 
httpclient codebase..


Regards,
Pavel

On 08/05/15 10:12, Oleg Kalnichevski wrote:

On Thu, 2015-05-07 at 20:21 +, Tony Anecito wrote:

Hi All,Does httpclient support websockets? I want to try websockets out and I 
am hoping httpclient might support and saw some emails from 2010 talking about 
it.I am willing to use another package if needed.
Regards,-Tony

Tony
HttpClient does not support websockets, and is unlikely to support it in
the future. I am working on adding HTTP/2 support, though.

Oleg


-
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



HTTP Upgrade support

2014-04-14 Thread Pavel Bucek

Hi all,

is Http(Async)Client capable of handling upgraded request? I mean - can 
I somehow plug in my HttpUpgradeHandler [1][2], something similar to 
what was introduced in Servlet 3.1 - non blocking read/write access to 
the underlying connection.


Thanks and regards,
Pavel

[1] 
http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpUpgradeHandler.html
[2] 
http://docs.oracle.com/javaee/7/api/javax/servlet/http/WebConnection.html


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