Hi,
I get strange behavior from HttpClient with parameter CoreConnectionPNames.CONNECTION_TIMEOUT set to 1.
I would expect that HttpGet request would fail, throwing connection timeout exception and yet they are successful. This seems irrational as it actually means that TCP handshake finished in less then 1 millisecond.
The httpclient ...
With HttpClient, I am setting the default socket/connection timeout with the following:
HttpParams params = new BasicHttpParams();
HttpConnectionParams.setSoTimeout(params, 30000);
HttpConnectionParams.setConnectionTimeout(params, 30000);
mClient = new DefaultHttpClient(connectionManager, params);
I'm wondering if I can override the...
I am trying to use jakarta commons http client. Doing kerberos authentication to communicate with a server. Authentication always fails. On digging deeper I found out that the kerberos token header has carriage return line feed characters in it which is the root cause of the issue. Why does it have \r\n characters and why is that an issu...
I use apache commons http client to send data via post every second, is there a way to make the following code more efficient? I know http is stateless, but is there anything I can do to improve since the base url is always the same in this case(only the parameter value change.
private void sendData(String s){
try
{
...
Hello Friends,
I am using apace http common for sending a request.When sending an http request a connection timeout occurs, the HttpClient.execute method throws a java.net.SocketException instead of a org.apache.http.conn.ConnectionTimeoutException.
ava.net.ConnectException: Connection timed out: connect
at java.net.PlainSocket...
Hi,
I need to pass from commons-httpclient-3.0.jar to commons-httpclient-3.1.jar
but changing the jar my code doesn't work any more.
The problem is that the new library encode automatically the passed uri.
Is there a way to avoid this?
I must interact with Yahoo API and I mustn't encode the URI otherwise I can't access to the se...
I'm using apache httpclient 4.0 to connect to a video stream (motion jpeg) over http. Here's my code:
DefaultHttpClient client;
HttpParams params = new BasicHttpParams();
List<String> authpref = new ArrayList<String>();
authpref.add(AuthPolicy.DIGEST);
authpref.add(AuthPolicy.BASIC);
params.setParameter("http.auth.proxy-scheme-pref",...
My Java application is developed using HttpClient 3. Is there any advantages of switching to version 4?
Is there a changelog. article, blog entry or something that describes what's new?
...
Hello,
I have created a sample application in Java with sending POST request to a asp.net web page "mypage.aspx". This apsx page sending back some response and 1 headers to check its valid or not.
Aspx page set headers like Response.AddHeader("my-source", "lmenaria.com");
In my Java program:
Header[] headers = method.getResponseHe...
Couldn't figure out why I'm getting Null pointer here : System.out.println(method.getStatusCode()); !?
method initialized and successfully executed!
Any ideas?
Sample code here. I'm using commons-httpclient-3.1.jar
PostMethod = new PostMethod(url);
LogInHelper.logRequest(httpClient, method);
try {
...
To enable logging for apache commons HttpClient in normal Java application I used:
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wir...
What is the difference between EntityTemplate and StringEntity
Below is the code from the HttpClient Tutorial. Not sure I understand why you would do this verses using a StringEntity
ContentProducer cp = new ContentProducer() {
public void writeTo(OutputStream outstream) throws IOException {
Writer writer = new OutputStrea...
Hi All,
I'm looking to make an HTTP post request given the raw data that I have. I've spent a while looking for the solution, made a handful of attempts and I'm looking for a little bit of help. The PHP code for what I'm looking to do looks like this:
<?
$url="http://localhost:3000";
$postdata="<?xml version=\"1.0\" encoding=\"UTF-8\"?...
Researching the web, I've found that pipelined Http is much faster and more power efficient (specially for mobile devices) than queued or parallel connections. The support from general libraries however seams to be small. Just recently has the widespread Apache HttpCore project gained support through its NIO module.
At least it says so ...
hi all, I'm using the apache commons 4.x HTTPClient to make HEAD requests to URIs only to get the final post 302 URL location of that link. E.g: http://bit.ly/test1231 really points to cnn.com or something. What would be the best and most efficient way using HttpClient to achieve this in a server that could run for months with out leaki...
I found a URL that httpclient doesn't seem to be handling redirects on:
http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNGrJk-F7Dmshmtze2yhifxRsv8sRg&url=http://www.mtv.com/news/articles/1647243/20100907/story.jhtml
should 302 to:
http://www.mtv.com/news/articles/1647243/20100907/story.jhtml
when I look at the headers i...
Hi everyone,
I have to display an html from another domain in my company's website. My company's website is behind a proxy and it is a secured site (https). The html page I want to display is not https. I tried iframe, but it is giving 'non-secure items' message. What is the best method to display an html page from another domain ...
I'm working on a library that is meant to be integrated in other applications. I have to communicate with a https server, and I'm using apache commons HttpClient 3.1. I have my own keystore and need to register a Protocol via: Protocol.registerProtocol. I was wondering if there was a way to register this for my specific instance of th...
Hi all,
I'm implementing a SOLR server in our application.
We use the CommonsHttpSolrServer in the SolrJ package to connect to our solr server which uses the commons-httpclient.
We also use Spring.
Now our sysadmin secured the solr server (with good reason) and used Basic Auth.
How can I instantiate a HttpClient with Basic Auth to be ...