Hi Davide,

Yes, it looks like <http://www.w3.org/TR/xhtml1> redirects to <http://www.w3.org/TR/xhtml1/> with a 301 redirect response. HttpClient automatically handles this redirection, unless you disable redirection. When redirected, the original headers are overwritten. You can get the final path from the HttpMethod using HttpMethod.getPath().

Mike

On Jan 25, 2004, at 5:14 AM, Davide wrote:

Hi all! I'm a really newbye and i'm in a mess with the following thing:

I'm creating a class to resolve relative links given a base uri; Now I use as base uri the uri I typed; but sometimes the remote web server redirects my request to other pages and i can't know what is the real base uri

for example i'm having problems with this:

in a page I have an a element with href=http://www.w3.org/TR/xhtml1

then i notice dusing a browser that the request changes in http://www.w3.org/TR/xhtml1/ (i see in the address bar)

so a "/" is added in the end, that is very different when i compute the base uri

I think that this change is due to a redirection, but i don't know how to make it available to my class;

i tried using:

Header locationHeader = method.getResponseHeader("location");
redirectLocation = locationHeader.getValue();

i read it in http://jakarta.apache.org/commons/httpclient/redirects.html

because i read that the base uri is stored in the response header, but without success;so how can I do it?

for example, how can my browser(mozilla) know that http://www.w3.org/TR/xhtml1 changes in http://www.w3.org/TR/xhtml1/ ??

Best Regards, Davide






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to