hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: help on images path
Date Fri, 09 Jun 2006 19:23:39 GMT
Hello,

> I go to a site www.yahoo.com <outbind://3/www.yahoo.com>  using my
> servlet "http://raj.per.com/get_http?url=www.yahoo.com
> <http://raj.per.com/get_http?url=www.yahoo.com> 
> 
> When I get the response, I get the text, but all the images on yahoo
> site "/images/image1.jpg" is referring in
> "raj.per.com/get_http/images/image1.jpg" instead of
> "www.yahoo.com/images/image1.jpg
> <outbind://3/www.yahoo.com/images/image1.jpg> "

What you are trying to do is called "reverse proxying".
HttpClient will only help you to fetch documents, but
changing the URLs in them is the responsibility of your
application.

> How can I make to refer images in the yahoo doamin "www.yahoo.com
> <outbind://3/www.yahoo.com> " instead of my doamin
> "raj.per.com/get_http"

The HTML page obviously uses relative links, which are resolved
by user agents based on the URL of the document. The user agent
has the URL pointing to your servlet, but your servlet fails
to process these URLs. From your question, I assume that you
do want the user agent to access the yahoo domain directly to
get the images.
Your options are:
1. Have the user agent fetch the HTML file directly from the
   yahoo domain, too. Your servlet can send a redirect there
   instead of fetching and returning the HTML file.
2. Process the HTML file in your servlet, replacing all relative
   URLs by absolute URLs pointing directly to the yahoo domain.
3. Process the HTML file in your servlet, replacing or adding a
   <BASE> tag in the <head> section, pointing to the yahoo domain.
   This will have the user agent use a different base URL for
   resolving relative URLs.

I have no idea what the outbind: protocol in your examples is
supposed to do. Maybe that's some garbage added by your mail
program?

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message