You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using this client to make http requests. There are cases in which I am only interested in headers and not in content of the response. I dont want to use "head" method as not all servers support this methis. I want to use "get" method but once I get the headers I dont want to receive content from the server. Is it possible with this library or any pointers how it can be done using netty.
Thanks & Regards,
Tanima
The text was updated successfully, but these errors were encountered:
You'll want something like this. It's slightly awkard because you need a reference to the ResponseFuture inside the receiver (maybe there should a way for the receiver to call an instance method to cancel), but you would do it like this:
finalAtomicReference<ResponseFuture> futureRef = newAtomicReference<>();
futureRef.set(client.get().setURL("http://foo.example").on(StateType.HeadersReceived, newReceiver<HttpHeaders>() {
@Overridepublicvoidreceive(HttpHeadersobject) {
// do something with the headersfutureRef.get().cancel();
}
}).execute());
You may want to override the Receiver's onFail() and onFail(Exception) methods to be notified if a connection cannot be opened or is unexpectedly closed by the server.
Hi,
I am using this client to make http requests. There are cases in which I am only interested in headers and not in content of the response. I dont want to use "head" method as not all servers support this methis. I want to use "get" method but once I get the headers I dont want to receive content from the server. Is it possible with this library or any pointers how it can be done using netty.
Thanks & Regards,
Tanima
The text was updated successfully, but these errors were encountered: