The Jakarta Commons offer tools to help the everyday developer. In this article, Harshad Oak discusses the HttpClient and FileUpload components. He walks us through the usage of the two components via example.
Read HttpClient and FileUpload
-
TSS Article on HttpClient and FileUpload (13 messages)
- Posted by: Nitin Bharti
- Posted on: August 03 2004 12:08 EDT
Threaded Messages (13)
- Cool... but complicated, no? by Vlad Patryshev on August 09 2004 14:52 EDT
- Are there any commercial versions of Http Clients available? by Ramana Gupta Narayanam on August 09 2004 23:02 EDT
- jCookie by Frank Cohen on August 09 2004 11:31 EDT
-
Are there any commercial versions of Http Clients available? by George Tavares on August 10 2004 09:12 EDT
- CVS version details by Alagesan Pandy on August 10 2004 10:30 EDT
- Are there any commercial versions of Http Clients available? by Ramana Gupta Narayanam on August 09 2004 23:02 EDT
- memory issue with commons file upload by Julien Viet on August 09 2004 19:53 EDT
- Vey Helpful by ChinmaY OgalE on August 10 2004 01:06 EDT
- Http proxy error by c tang on August 10 2004 13:43 EDT
- Http proxy error by Mohsin Ali on August 11 2004 02:39 EDT
-
Http proxy error by c tang on August 11 2004 10:31 EDT
-
Http proxy error by Mohsin Ali on August 12 2004 05:34 EDT
-
Http proxy error by c tang on August 12 2004 09:18 EDT
- Code does not work in Laptop by Atul Patel on September 16 2008 04:27 EDT
-
Http proxy error by c tang on August 12 2004 09:18 EDT
-
Http proxy error by Mohsin Ali on August 12 2004 05:34 EDT
-
Http proxy error by c tang on August 11 2004 10:31 EDT
- Http proxy error by Mohsin Ali on August 11 2004 02:39 EDT
-
Cool... but complicated, no?[ Go to top ]
- Posted by: Vlad Patryshev
- Posted on: August 09 2004 14:52 EDT
- in response to Nitin Bharti
It is still a good step in the right direction.
As an alternative, check out this: http://www.devx.com/Java/Article/17679/0
Also, the server side of the game (together with the aforementioned client side) is published here: http://www.myjavatools.com/
Thanks,
Vlad -
Are there any commercial versions of Http Clients available?[ Go to top ]
- Posted by: Ramana Gupta Narayanam
- Posted on: August 09 2004 23:02 EDT
- in response to Vlad Patryshev
I checked nogoop. It doesn't satisfy all my requirements. I need cookie and session management also in the libraries. Is there any package available?
Ramana -
jCookie[ Go to top ]
- Posted by: Frank Cohen
- Posted on: August 09 2004 23:31 EDT
- in response to Ramana Gupta Narayanam
The HTTP protocol handler in TestMaker's TOOL library uses jCookie to handle cookies and maintain sessions. jCookie has worked well for my application. Details are at:
http://jcookie.sourceforge.net/
And the PushToTest Web site hosts jCookie's JavaDoc at:
http://docs.pushtotest.com/jcookie/jCookie-0.8b/docs/api/
Hope this helps.
-Frank -
Are there any commercial versions of Http Clients available?[ Go to top ]
- Posted by: George Tavares
- Posted on: August 10 2004 09:12 EDT
- in response to Ramana Gupta Narayanam
I checked nogoop. It doesn't satisfy all my requirements. I need cookie and session management also in the libraries. Is there any package available?Ramana
I checked it too. I had the same problem with cookie and sessions. Then I try de CVS version and it's ok. Cookies and Sessions works very well. -
CVS version details[ Go to top ]
- Posted by: Alagesan Pandy
- Posted on: August 10 2004 10:30 EDT
- in response to George Tavares
Can you provide more details of the software you have tried. -
memory issue with commons file upload[ Go to top ]
- Posted by: Julien Viet
- Posted on: August 09 2004 19:53 EDT
- in response to Nitin Bharti
There is a memory issue with commons fileupload, it allocates way too much memory for each field in the request, you can see more about it here : http://www.jboss.org/wiki/Wiki.jsp?page=KnownBugs -
Vey Helpful[ Go to top ]
- Posted by: ChinmaY OgalE
- Posted on: August 10 2004 01:06 EDT
- in response to Nitin Bharti
The article is very helpful. Harshad Oak covers all the basic functions can be done using HTTPClient and File Upload Components. -
Http proxy error[ Go to top ]
- Posted by: c tang
- Posted on: August 10 2004 13:43 EDT
- in response to Nitin Bharti
We have a proxy that requires username and password to access internet. I have trouble with the proxy. By following the direction in the article, here is the code,
HttpClient client = new HttpClient();
client.getHostConfiguration().setProxy(proxyhost, 80);
client.getState().setProxyCredentials("Basic", proxyhost,
new UsernamePasswordCredentials(userID, password));
Here is the response
*** Request ***
Request Path: /
Request Query: null
User-Agent: Jakarta Commons-HttpClient/2.0.1
Host: www.yahoo.com
Proxy-Connection: Keep-Alive
*** Response ***
Status Line: HTTP/1.1 407 Proxy Authentication Required
Date: Tue, 10 Aug 2004 17:29:15 GMT
Content-Length: 257
Content-Type: text/html
Server: NetCache appliance (NetApp/5.6)
Proxy-Connection: close
Proxy-Authenticate: Negotiate
Proxy-Authenticate: NTLM
Proxy-Authenticate: Basic realm="NETCACHE"
*** Response Body ***
<HTML>
<HEAD><TITLE>407 Proxy Authentication Required</TITLE></HEAD>
<BODY>
<H1>Proxy Authentication Required</H1>
<H4>
Unable to complete request:<P>
Access denied due to authentication failure.
</H4>
<HR>
</BODY>
</HTML>
How do I get around this problem?
Thanks!
ct -
Http proxy error[ Go to top ]
- Posted by: Mohsin Ali
- Posted on: August 11 2004 02:39 EDT
- in response to c tang
Dear c tang,
The response header returned from proxy server NetApp/5.6 indicates that NLTM authentication scheme is used. so try this one:
client.getState().setProxyCredentials("NTLM", proxyhost,
new NTCredentials(userName, password, host, domain)); -
Http proxy error[ Go to top ]
- Posted by: c tang
- Posted on: August 11 2004 10:31 EDT
- in response to Mohsin Ali
Dear Ali,
I tried your suggestion before, it yielded the same result. I also tried to use NETCACHE and case variations of them. Nothing works! -
Http proxy error[ Go to top ]
- Posted by: Mohsin Ali
- Posted on: August 12 2004 05:34 EDT
- in response to c tang
Try it with null realm i.e.
client.getState().setProxyCredentials(null, proxyhost, new NTCredentials(userName, password, host, domain)); -
Http proxy error[ Go to top ]
- Posted by: c tang
- Posted on: August 12 2004 09:18 EDT
- in response to Mohsin Ali
Thanks, it works.
In httpclient Authentication guide, it states "It is generally advised that while initially testing NTLM authentication, you pass the realm in as null which is used as the default." I intepret that a realm should be passed in real product system. However, I got a 407 error if a realm is passed as argument. -
Code does not work in Laptop[ Go to top ]
- Posted by: Atul Patel
- Posted on: September 16 2008 04:27 EDT
- in response to c tang
Hi, I found this code very helpful. I have deployed this code in Desktop where it works fine, but when I am running on laptop then it sends the error saying connection refused (I am configuring the proxy server settings). My understanding is since it uses the HTTP post method and if laptop does not have the COM ports, it does not work. Is my understanding is correct? Please help me out to resolve this error. thanks