httpclient

How to make the http connection timeout/disconnected after a time interval??

hi I am new in apache HttpClient, I used the following code to get the http connection timeout (disconnected) after certain time interval: PostMethod method = new PostMethod(authURL); HttpClient client = new HttpClient(); HttpClientParams params= new HttpClientParams(); params.setParameter(params.CONNECTION_MANAGER_TIMEOUT, 10); //10 N...

Java HttpClient NoSuchAlgorithmException

I'm using IBM's build of Java with HttpClient and having little success. Whenever I use the HttpClient object's executeMethod(), I get a NoSuchAlgorithmException. Dec 22, 2009 2:59:58 PM com.ibm.rcp.security.ssl.PlatformSSLProtocolSocketFactory createPlatformSSLContext() WARNING: CWPST502W: The algorithm for recovering the key from th...

Secure iNet Factory and Apache httpclient, which one is more powerful?

Hi, I'm new to both of the two libraries. Now I need a java http library in my application. My question is which of the two is more powerful? Thanks. PS: Secure iNet Factory: http://www.jscape.com/secureinetfactory/index.html ...

BindException: address already in use on a client socket?

I've got a client-server tiered architecture with the client making RPC-like requests to the server. I'm using Tomcat to host the servlets, and the Apache HttpClient to make requests to it. My code goes something like this: private static final HttpConnectionManager CONN_MGR = new MultiThreadedHttpConnectionManager(); final Ge...

Sending a serialized object from Android to a servlet using HTTP client

Hey guys I have tried to create a android application that sends a serialzed object from the phone to a servlet the contents of the object is the input from the user which i will store in a database using hibernate. I believe the problem is around the serializing and deserializing of the object the code is below. If anyone could help i ...

Accepting a certificate for HTTPs on Android

I'm trying to make Https connections on the Android phones, using HttpClient. Trouble is that since the certificate isn't signed I keep getting "javax.net.ssl.SSLException: Not trusted server certificate". Now I've seen a bunch of solutions where you simply accept all certificates, but what if I want to ask the user? I want to get a dia...

Authentication fails in HttpClient but OK in browser

I'm using HttpClient 4.0 to get some XML from the remote host. When I use URL such as https://user:[email protected] it works fine in the browser but fails in the HttpClient with this stacktrace (follows). Any suggestions? I'm using SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER while setting ThreadSafeClientConnManager to handle HTTPS ...

Preemptive Basic authentication with Apache HttpClient 4

Is there an easier way to setup the http client for preemptive basic authentication that what described here? In previous version (3.x) it used to be a simple method call (eg, httpClient.getParams().setAuthenticationPreemptive(true)). The main thing I want to avoid is adding the BasicHttpContext to each method I execute. ...

How can I use user's certificate?

I can't understand general scheme using certificates. For example: I have account on the some website. I have name and password. What should I do to login to this site? - I should open _https://website:443/login and fill out fields, and if all is ok, I'll obtain admittance. Now, I would like to perform these steps programmatically usin ...

Python urllib2 Progress Hook

I am trying to create a download progress bar in python using the urllib2 http client. I've looked through the API (and on google) and it seems that urllib2 does not allow you to register progress hooks. However the older deprecated urllib does have this functionality. Does anyone know how to create a progress bar or reporting hook usin...

HttpClient alternative in Eclipse API

For HTTP communications in Java, I normally use the HttpClient library. However, my latest project utilizes the Eclipse API. Are there features in the API that have the same capabilities as HttpClient? As implied, this particular project requires me to use GET, PUT, and POST requests. I also need to post multipart MIMEs where the Con...

Get hold of redirect url with Java org.apache.http.client.

Hi Experts! I need help with figuring out how to get hold of the redirect after I make a post to the server. First, I need to do a get to obtain some cookies from the server. Then I perform a post with the cookies and additional parameters. The server then answers with a 302 redirect. How do I get the url for that redirect? Code looks...

HttpClient login, search and get the xml content

I want to login to a site using HttpClient and after logging in I want to search for something and retrieve the contents of the search result. /** * A example that demonstrates how HttpClient APIs can be used to perform * form-based logon. */ public class TestHttpClient { public static void main(String[] args) throws Exception { ...

Why doesn't HttpClient work but HttpUrlConnenction do when posting data to form.

Hello experts! I'm building an android app which should perform a GET on my site to get two cookies and then perform a post to the same site with these cookies. As mentioned I start of with the GET and I'm using org.apache.http.client.HttpClient to perform this operation. String requiredCookies = ""; HttpContext localContext = null;...

Login to site with HttpClient Post

I am trying to make a program that logs into a site and performs some automated activities. I have been using HttpClient 4.0.1, and using this to get started: http://hc.apache.org/httpcomponents-client/primer.html. On this particular site, the cookies are not set through a "set-cookie" header, but in javascript. So far, I am unable to...

PostMethod setRequestBody(String) deprecedated - why?

I am using Apache Commons HttpClient PostMethod 3.1. In the PostMethod class there are also three methods for setting POST method's request body: setRequestBody(InputStream body) setRequestBody(String body) setRequestBody(NameValuePair[] parametersBody); NameValuePair API First two methods are deprecated. Does anybody knows why? Bec...

httpclient get and put

hi all, here is what i want to do and need some help in it. I have a source url and a destination url. what i want to do is copy a file from a source url to the destination url, but I want to avoid copying the file locally on my system before uploading the file again. Also what is must to have is that we should get the content-length b...

How can we upload the file using http post?

I am using HTTP API called HttpClient to upload the file using "post", but haven't been able to find any sample code for the same. Any ideas? Any examples/implementations? Edit:- I meant HTTP API called HttpClient - See "Consuming RESTful Services with HttpClient" here ...

retriving complete webpage using httpclient

hi.i am a new bie to java.i had a problem i need to save a complete webpage(with all its contents like images,css,javascript e.t.c) like how we can do with save as-->complete webpage option with HttpClient lib.plese show me a way how to do this. ...

HttpClient - getting incorrect page source

I used HttpClient and GetMethod to get the page source of the URL : http://www.google.com/finance?chdnp=1&chdd=1&chds=1&chdv=1&chvs=Logarithmic&chdeh=0&chdet=1264263288788&chddm=391&chddi=120&chls=Ohlc&q=NSE:.NSEI& But somehow I always end up getting page source of : http://www.google.com/...