commons-httpclient

Apache commons httpclient - disable debugging / lower debuglevel

Hi, i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line : [INFO] AuthChallengeProcessor - basic authentication scheme selected Do you know how to disable the integrated loging or how to set a lower debug level ? ...

AIX: IBM Java: java.net.SocketException: Connection timed out:could be due to invalid address

We have seen the following exceptions very frequently on IBM AIX when attempting to make an SSL connection to our server: java.net.SocketException: Socket closed at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275(Compiled Code)) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275(Compiled Code)) at java.io.BufferedO...

Apache Commons HTTPClient 3.x leaving connections open

I'm using HttpClient to execute a PostMethod against a remote servlet and for some reason a lot of my connections are hanging open and hogging up all of my server's connections. Here's more info about the architecture GWT client calls into a GWT Service GWT service instantiates a HttpClient, creates a PostMethod and has the client execut...

Posting contents of a file using HttpClient ?

I want to send the contents of a file as part of a http request using Apache HttpClient and I could not figure out how to pass on the file contents in the request body. ...

Apache Commons HttpClient PostMethod support?

I am curios about how one can set the request properties for a PostMethod in Apache Commons HttpClient? I am refactoring some code written using HttpURLConnection class to post which looks like the following: conn1.setRequestProperty( "Content-Type", "multipart/related; type=\"application/xml\"; boundary=" + boundary); conn1.s...

Issue with trying to Login to a https secure using apache commons httpclient class

Hi, Iam trying to login to a https secured site using Apache commons httpclient. Iam not getting any way to pass the certificate along with my httprequest , since I cannot find any such classes in HttpClient Package. If anybody can guide me on where do I need to add the certificate handling? Any package to do it? Am open to ideas, a...

Unable to authenticate to SSL site in java: "pathLenConstraint violated - this cert must be the last cert in the certification path"

Hi, I'm trying to read from a secure (i.e. SSL) web page, in Java code. I'm trying to use both URLConnection (java.net) and Apache's HTTPClient. In both cases, when I make the request, I get this exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.securit...

Can two different clients somehow share cookies?

Here's the set-up: I have a server-based application. So, all the data is on a server (call it server 'A') and users connect to that server using a desktop-based rich client. The rich client also allows the user to connect to some other server (call it 'X'), that is completely unrelated to server A. Question: The user has logged into ...

How do I configure apache httpcore 4 to use a proxy?

I'm trying to use the latest (4.0.1) Apache http core components library. However, my web browser goes through a proxy - suppose it is myproxy.com:9191. Could someone provide some sample code for getting a simple http get to use this as a proxy? I've tried adding the following at the beginning of my code, but had no joy: ProxySelector....

Reading and terminating stream in HttpClient 4

I'm reading large documents from which I only need top 5%, can I do the following with HttpClient 4? Request the page (get or post) Read response as a stream Feed it into SAX-based HTML parser "on the fly" When certain HTML tag is detected - terminate the stream Please note that HttpClient v. 4 is required - I cannot use v. 3 ...

How can I configure HTTPClient to authenticate against a SOCKS proxy?

I need to set up proxy authentication against a SOCKS proxy. I found out this post giving instructions that appear to work with common HTTP proxies. httpclient.getHostConfiguration().setProxy("proxyserver.example.com", 8080); HttpState state = new HttpState(); state.setProxyCredentials(new AuthScope("proxyserver...

How do I count the number of 100 Continues the server sent me?

I am using Apache Commons HttpClient 3.1, and I found that HttpURLConnection from Sun drops the 100 Continues from the stream. So therefore I don't seem able to get the 100 Continue as they are apparently dropped by Sun's code. I am unable to move forward to HttpClient 4.0 as that would require many changes to already existing code so ...

Help using Facebook REST API - Notifications.send using HttpClient (Java)

Hello there, I am using the session proxy method to login to Facebook using Facebook Connect (via my iPhone simulator) and obtain my session key. Am using server side Java to send the notification, however. What I am trying to do is just send a user to user notification back to myself (that's why I set the to_uids as an empty string). I...

How to prevent apache http client from following a redirect

I'm connecting to a remote server with apache http client. the remote server sends a redirect, and i want to achieve that my client isn't following the redirect automatically so that i can extract the propper header and do whatever i want with the target. i'm looking for a simple working code sample (copy paste) that stops the automatic...

Connect.registerUsers - Need helping creating array for accounts param

I keep getting the following error when I try to invoke the Facebook REST API Call: Connect.registerUsers Error Code: 100 - param accounts must be an array JSON based response (from Facebook): {"error_code":100,"error_msg":"param accounts must be an array.","request_args": [{"key":"accounts","value":"{email_hash:5232156322_55ddgvc3d...

Android: One vs many instances of HttpClient per application

Until recently, our app shared a single Apache HttpClient instance using the ThreadSafeClientConnManager across the whole application. The http client instance was held by a singleton class. Since I dislike the singleton pattern for its numerous problems, I refactored our API accessor to be a per-thread object, but now for every thread ...

Redirect with Curl/HttpClient: header "Location" missing.

Hi all, when I get the following url with curl curl -D headers.http "http://www.springerlink.com/index/10.1007/s00453-007-9157-8" the file headers.http contains a "Location" header: HTTP/1.1 302 Found Date: Tue, 27 Oct 2009 17:00:20 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Location: http://www.s...

How to get current Transfer Rate in Commons HttpClient 3.x

I have some code that does a bunch of HTTP GETs, POSTs, and PUTs using Commons HttpClient 3.1. I'd like to provide a current transfer speed indicator in my GUI, but was unable to find any methods for determining the transfer rate of a HttpMethod being processed. I could easily just time the transfer and do some simple math after it was...

Using Groovy and HttpBuilder for XML-RPC access

The groovy own library for XML-RPC does not support basic authorization. I try to use httBuilder ( http://groovy.codehaus.org/modules/http-builder/home.html ) build on top of HttpComponents http://hc.apache.org/) to access TRAC via XML-RPC. def postBody = """ <?xml version="1.0"?> <methodCall> <methodName>wiki.getPage</methodName> <par...

Acegi throws AuthenticationCredentialsNotFoundException when opening URl with BrowserLauncher 2

Hi all, We have a JSF web application that uses Acegi security. We also have a standalone Java Swing application. One function of the Swing app is to load the user's home page in a browser window. To do this we're currently using Commons HttpClient to authenticate the user with the web app: String url = "http://someUrl/j_acegi_securit...