Forcing Connection: Close

2011-12-01 Thread William Speirs
I'm trying to make a simple HTTP/1.0 request where the Connection header is set to Close. I have the following basic code: HttpParams params = new SyncBasicHttpParams(); // set the version to 1.0 params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0.toString()); httpclient

Re: set different socket timeout for same httpclient using MultiThreadedHttpConnectionManager

2011-12-01 Thread William Speirs
Depending on you performance needs, you could make a new client in each send call, and the set the socket timeout. Bill- On Dec 1, 2011 5:22 PM, "vijay kolli" wrote: > i have two threads using the same instance of the HTTPClientTest. two > threads call the send method on the same HTTPClientTest.

Re: set different socket timeout for same httpclient using MultiThreadedHttpConnectionManager

2011-12-02 Thread William Speirs
(postBody); >int status = httpClient.executeMethod(post); > reply = post.getResponseBodyAsString(); > } > >} > > > > On Thu, Dec 1, 2011 at 4:36 PM, William Speirs wrote: > > Depen

Re: set different socket timeout for same httpclient using MultiThreadedHttpConnectionManager

2011-12-02 Thread William Speirs
ng like via SSL. So what could be the > overhead of creating a separate httpclient on each send call. > > On Fri, Dec 2, 2011 at 9:24 AM, William Speirs wrote: > > Yea... I mentioned performance only because there is some overhead in > > creating a new client, especially if you&

Modifying the URI of an HttpRequest

2011-12-02 Thread William Speirs
What is the easiest way to modify the URI of an HttpRequest? I'm about to write code like this: HttpRequest newReq = new BasicHttpRequest(// fill in with method, new uri, and protocol version); // copy all headers // copy entity body This seems like a lot of work when I all I really want is a .se

Re: Modifying the URI of an HttpRequest

2011-12-02 Thread William Speirs
Basically, my question is why isn't there a setRequestLine method for the HttpRquest interface? The HttpMessage interface has all kinds of set methods for headers and such, why not a set method for RequestLine in HttpRequest? Thanks... Bill- On Fri, Dec 2, 2011 at 4:12 PM, William Speirs

Re: httpclient.defaultMaxPerRoute and maxTotalConnections questions

2011-12-05 Thread William Speirs
On Mon, Dec 5, 2011 at 6:07 PM, mpindyala wrote: > We have a java web application which makes calls to 2 of our third party > Services using httpclient. > > Following are the settings for > org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManagerr. the numbers > are ridiculously high > httpclie

Re: httpclient.defaultMaxPerRoute and maxTotalConnections questions

2011-12-06 Thread William Speirs
On Tue, Dec 6, 2011 at 1:30 PM, mpindyala wrote: >> Yes , its just a thread .  We did this to save 10-30ms for each http >> request that application does to back end providers. It seems connection >> manager takes 10-30ms just to close idle and expired connections before >> they can be reused.  Pl

Re: Guidance on the use of EntityUtils.consume

2011-12-06 Thread William Speirs
As per the documentation, HttpEntity.consumeContent() is deprecated. You should use EntityUtils.consume() instead. The code for that is straightforward: public static void consume(final HttpEntity entity) throws IOException { if (entity == null) { return; }

Re: Guidance on the use of EntityUtils.consume

2011-12-06 Thread William Speirs
was the heart of my question. > > > > > Todd Lainhart > Rational software > IBM Corporation > 550 King Street, Littleton, MA 01460-1250 > 1-978-899-4705 > 2-276-4705 (T/L) > lainh...@us.ibm.com > > > > > From: William Speirs > To: HttpClie

Re: httpclient.defaultMaxPerRoute and maxTotalConnections questions

2011-12-08 Thread William Speirs
On Wed, Dec 7, 2011 at 6:39 PM, mpindyala wrote: > so you are saying  max per route cannot be more than maxtotal connections? Yes. My explanation before was confusing at best. As I understand it, a route is to a specific host. A connection is just a socket. So you can limit both the number of con

Re: Configuring default timeouts using system properties

2011-12-08 Thread William Speirs
I don't think so, but you can always map those properties into the connection properties for HttpClient. Bill- On Thu, Dec 8, 2011 at 1:47 PM, Stevo Slavić wrote: > Hello httpclient users, > > Is it possible to configure default timeouts (connection and socket) using > java system properties in

Re: HTTPClient SOCKS proxy setup, DNS name is not resolved - UnknownHostException

2011-12-12 Thread William Speirs
What does a TCP dump for the JRE vs Apache Client through the SOCKS proxy look like? You can also up the log level of the client to debug... Bill- On Dec 12, 2011 1:25 AM, "VJ" wrote: > Hello All, > I am facing a strange problem with HTTPClient and SOCKS proxy. > I have a test setup with HTTPCl

Re: preemptive basic authentication

2011-12-16 Thread William Speirs
Basically you're just sending your user/pass out (in clear text if you're not using HTTPS) to a server that didn't even ask for it. Now if the systems are internal to your network and you want to assume that risk, not reason why you couldn't do it... Bill- On Dec 16, 2011 3:37 AM, "Даниел Симеоно

Re: HttpCore server in load balancing schemes

2011-12-22 Thread William Speirs
Often (like in web browsing) the client is unaware of any load balancing on the server's end. What were you thinking the client would need to do? Bill- On Dec 22, 2011 5:40 AM, "Aekold Helbrass" wrote: > Good day! > > We need to add both Layer4 and Layer7 load balancing schemes to our > small Ht

Re: Httpclient 4 inside a JSP TAG

2012-01-05 Thread William Speirs
Could you setup a session listener and call create/shutdown there? Bill- On Thu, Jan 5, 2012 at 8:31 AM, Amon wrote: > > Hi all, > > I have a question concerning the use of HTTPClient 4 inside a JSP Tag > > It's about the creation of the DefaultHttpClient object and how to shutdown > the Connec

Re: Httpclient 4 inside a JSP TAG

2012-01-05 Thread William Speirs
e.com/javaee/6/api/javax/servlet/http/HttpSessionListener.html Bill- 2012/1/5 Yakup YÜCE : > How can you make a session listener for HttpClient? > > On Thu, Jan 5, 2012 at 5:00 PM, William Speirs wrote: > >> Could you setup a session listener and call create/shutdown there? >>

Re: ClientProtocolException

2012-01-19 Thread William Speirs
I think because there is a modifier which is setting this header, then you're trying to do it manually and getting this exception. What happens if you remove the manual setting of the header? Bill- On Jan 19, 2012 6:02 PM, "Mohit Anchlia" wrote: > When we do a POST we are getting the following e

Re: Help with Multiple Connections

2012-02-19 Thread William Speirs
Can you post the stack trace. Bill- On Feb 18, 2012 8:01 PM, "m0j0j0j0" wrote: > > Hello all, ive been developing an automation tool for myself. > > After modifying the example code for a multithreaded get request, and > setting up all my logic, > i had everything working great. Testing with 134

RE: Issue: cannot get httpclient working in netbeans

2012-03-10 Thread William Speirs
How are you building then, ant? Bill- On Mar 10, 2012 6:30 AM, "Gregory Orton" wrote: > I don't have a pom.xml file. Not least one I can find in the project path. > > -Original Message- > From: kim young ill [mailto:khi...@googlemail.com] > Sent: 10 March 2012 19:13 > To: HttpClient User

RE: Issue: cannot get httpclient working in netbeans

2012-03-10 Thread William Speirs
more... Bill- On Mar 10, 2012 8:15 AM, "Gregory Orton" wrote: > It must be, as I use the build function built into netbeans. It wasn't by > choice - I didn't even know maven existed until a few days ago. > > I just chose "new java project" in netbeans. >

Re: Setting SOAPAction in HTTPPost header

2012-03-13 Thread William Speirs
Setting the params of the client is not what you want. You want to set a header in the request. Something more like: request.setHeader("SOAPAction", "mySOAPAction"); // [1] [1] http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/message/AbstractHttpMessage.html#setHeader(

Re: How do you do multi-threaded/parallel/chunk downloading with HttpClient?

2012-03-31 Thread William Speirs
I think that these download accelerators work by opening multiple connections to a site and perform byte-range fetching on blocks of the file, then stitch it back together. You could easily do this with HttpClient and a few threads. There are zero copy writing to file examples on the website... I

Re: How to use logging abilities of HttpClient?

2012-04-10 Thread William Speirs
How are you running all of this? Maven, Eclipse, NetBeans? Sometimes IDEs can put resources in weird places (I always struggled to divine where Eclipse wanted me to put my logging configuration files, until I started using Maven... /src/main/resources). I have the following XML configuration file

Re: Support HTTP Patch requests

2012-05-02 Thread William Speirs
No pun intended, but do you have a patch you want/can submit? Bill- On May 2, 2012 5:18 PM, "Rossen Stoyanchev" wrote: > Hi, > > I did not see any issues referring to this but wanted to ask before > opening one. Are there are any plans to add support for HTTP Patch > requests? Those have been st

Re: HC 4: Excluding images ang other types of content

2012-05-11 Thread William Speirs
By default if you point HC4 at a web page it will only download the HTML. You'd have to parse that HTML and extract all the links to get the images, JavaScript, etc. Give it a try... Bill- On Fri, May 11, 2012 at 1:41 PM, Mugoma Joseph Okomba wrote: > Hello, > > I am using HC 4 to download web

Re: Getting a compressed version of web page

2012-05-29 Thread William Speirs
Is the site setup to send a compressed version? Bill- On May 28, 2012 8:26 PM, "Mugoma Joseph Okomba" wrote: > Hello, > > I have setup URL download: > HttpGet request = new HttpGet(url); > request.addHeader("Accept-Encoding", "gzip,deflate"); > > response.getFirstHeader("Content-Encoding") shows

Re: Migration 4.0 -> 4.2

2012-07-23 Thread William Speirs
Where are you getting stuck? Most of the documentation specifies the new class/interface to use for deprecated classes/interfaces. For example, NHttpClientHandler is deprecated in favor of NHttpClientEventHandler. If you have a more specific question about how to accomplish something with the new

Re: How to get HttpResponse viewed in a JEditorPane?

2012-07-31 Thread William Speirs
My only suggestion is to read the contents of the response out to something else like a file, this way you know HttpClient is working as expected. I don't know enough about JEditorpane to help you with that... maybe you need to call flush on it? Bill- On Jul 30, 2012 6:04 AM, "Fredrik Andersson"

Re: Inherit cookies from applet session

2012-08-16 Thread William Speirs
I've never setup the client to deal with cookies, but there is information in the state management section: http://hc.apache.org/httpcomponents-client-ga/tutorial/html/statemgmt.html Bill- On Thu, Aug 16, 2012 at 4:40 AM, Austin, Carl wrote: > Hi, > > > > I am replacing some code in an applet, w

Re: Inherit cookies from applet session

2012-08-16 Thread William Speirs
Am I over complicating this or is it really this complicated to manage > the session within such an applet with HttpClient? > > -Original Message- > From: William Speirs [mailto:wspe...@apache.org] > Sent: 16 August 2012 14:20 > To: HttpClient User Discussion > Subject:

Re: Parsing of Set-Cookie in HTTPClient 3.1 Version

2012-10-01 Thread William Speirs
Can you provide a wire log from HttpClient (set log level to debug for the client)? Bill- On Thu, Sep 27, 2012 at 3:49 PM, Vasudevan Comandur wrote: > Hi, > > I am using HTMLUnit 2.6 which uses the HTTPClient 3.1 jar file. The > cookie value returned to HTMLUnit has corrupted values. > Tryin

Re: HttpClient with PoolingClientConnectionManager throws read time out

2012-10-15 Thread William Speirs
Do you have the wire logs? Bill- On Mon, Oct 15, 2012 at 7:23 AM, Jose Escobar wrote: > Hello, > > I'm using httpclient on a spring aplication to send http posts. > I have a shared singleton bean instance of DefaultHttpClient that I > use to execute httpPost, this DefaultHttpClient have a > Pool

FailoverHttpClient

2013-04-16 Thread William Speirs
A friend of mine created an extension to the DefaultHttpClient that allows for failover. Essentially, it will try one host and if that host is not available, then it will try others. The code can be found here: https://github.com/mcaprari/httpclient-failover Figured it might be useful to folks, so

Re: socketConnect Threads

2013-08-18 Thread William Speirs
Tough to tell without knowing a few things like the version of Http Components you're running. The good news is that it's all open source so you can dive into the code for your particular version and answer your own question! Bill- On Wed, Aug 14, 2013 at 6:59 AM, Rajeshwar Paani wrote: > Hi, >

Re: Some observations with HTTP Client 4.3.1

2013-11-13 Thread William Speirs
I'd like to chime in on the end of this... I've converted some code from 4.2.x to 4.3.x and it wasn't bad at all. I too am *loving* the fluent API. Great job Oleg!!! Bill- On Sun, Nov 10, 2013 at 11:45 AM, Oleg Kalnichevski wrote: > On Sat, 2013-11-09 at 23:15 +0100, Christopher BROWN wrote: >