On Mon, 2007-03-26 at 08:37 -0700, Dan Bezdek wrote: > Hi Everyone, > > I am new to HttpClient, and I am a little confused regarding a few issues. > Here are my issues: > > 1. What is the best way to take care of relative redirects. I am basically > adding a method that will check the redirect path and if path is relative, > then it would add the server's url, or the url of the context to the > beginning of the path. My question is what is the best way to get my hand > on the server's url and the context's url. I could pass these values in, but > I want to be able to retrieve these values from one of the classes in the > HttpClient rather than pass them in. After all, they must be stored > somewhere like in the HttpMethod that is being executed. Also, please let me > know if there is better way of handling relative redirects. >
Hi Dan You may want to disable the automatic redirect handling and adjust relative URLs manually the way you find suited best for your application http://jakarta.apache.org/commons/httpclient/redirects.html > 2. HttpResponse class. This class seems to have a lot of interesting such as > . However, I can't find any way of obtaining the HttpResponse instance > associated with a method that I have just executed. I execute my method in > the following way: > > HttpClient httpClient = new HttpClient(); > GetMethod getMethod = new GetMethod(url); > getMethod.setFollowRedirects(true); > int responseCode = httpClient.executeMethod(getMethod); > > Now, how can I obtain a reference to the HttpResponse associated with the > method executed above? > > 3. When I look at the latest API, there is no HttpResponse, but when I > search through mailing list or web, I get a lot of posting that includes > references to HttpResponse. Is HttpResponse somehow deprecated or something? > > HttpResponse interface will be introduced in the next major release of HttpClient (version 4.0). HttpClient 4.0 is still in the early ALPHA development stage. Hope this helps Oleg > > Thanks for taking time time to respond to my post. > Dan > > > > > --------------------------------- > Get your own web address. > Have a HUGE year through Yahoo! Small Business. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
