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
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/
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?
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.
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.
Can you provide more details of the software you have tried.
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
The article is very helpful. Harshad Oak covers all the basic functions can be done using HTTPClient and File Upload Components.
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();
new UsernamePasswordCredentials(userID, password));
Here is the response
*** Request ***
Request Path: /
Request Query: null
User-Agent: Jakarta Commons-HttpClient/2.0.1
*** Response ***
Status Line: HTTP/1.1 407 Proxy Authentication Required
Date: Tue, 10 Aug 2004 17:29:15 GMT
Server: NetCache appliance (NetApp/5.6)
Proxy-Authenticate: Basic realm="NETCACHE"
*** Response Body ***
<HEAD><TITLE>407 Proxy Authentication Required</TITLE></HEAD>
<H1>Proxy Authentication Required</H1>
Unable to complete request:<P>
Access denied due to authentication failure.
How do I get around this problem?
Dear c tang,
The response header returned from proxy server NetApp/5.6 indicates that NLTM authentication scheme is used. so try this one:
new NTCredentials(userName, password, host, domain));
I tried your suggestion before, it yielded the same result. I also tried to use NETCACHE and case variations of them. Nothing works!
Try it with null realm i.e.
client.getState().setProxyCredentials(null, proxyhost, new NTCredentials(userName, password, host, domain));
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.
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.