Forums Register Login

problem in forwarding a request

+Pie Number of slices to send: Send
I was using the following code to redirect a request

response.sendRedirect("http://www.google.com");

Yet, when I forward the request like the follwing

rd=request.getRequestDispatcher()
rd.forward("http://www.google.com");

it is taking the relative url....that is my context root is getting appended with the url.Is there a way to fix this?Basically I dont want the url to change.hats why I was using a forward instead of a redirect.Is there any other way of achieving this?

thank you in advance
+Pie Number of slices to send: Send
You cannot forward to a URL outside of your web application -- it makes no sense at all. What are you actually trying to achieve?
+Pie Number of slices to send: Send
Yeah.I know it might seem a bit weired but I want hide the page url so that if the url is checked by a filter, I can by pass it.Is there any other way of doing this inside a servlet?Any ways, thanks to you for replying.
+Pie Number of slices to send: Send
Are you trying to create a proxy to get around a firewall or ip filter like iPrism?
If so, there are a lot more issues that you will need to consider.

Remember web pages are made up of lots of resources (images, js pages, css sheets, etc...).
Each of these is fetched by the browser after the initial HTML is downloaded and parsed.
If you try to stream a page from another server through your app, you will also need to rewrite the HTML to change all of the URLs for these resources.

If you're trying to do something else, let us know what it is and we might be able to help.
+Pie Number of slices to send: Send
Yeah.I was exactly trying to do that.Could you give me some information about some tools which are available for achieving this?And the one you have named,iPrism,could you give me some information about that?
thanks in advance
+Pie Number of slices to send: Send
iPrism is a commercial product for filtering web content.
It's used a lot in schools and high security environments where we access needs to be restricted.
A Google search should find their home page pretty quickly.

As far as building a proxy goes, I've never done it but I can tell it would be a bit of work.
Like I said earlier, if you want to completely trick the network you're on into thinking that everything is coming from your site, you would need to parse any text files, and rewrite any URLs that point to the other server. This includes hyperlinks as well.
If the external site always uses relative links, it would be a little easier but you can't count on that.

If I were doing this, I would start by Googling around to see if there are any existing open source projects out there for doing this.

-Ben

PS: This topic is getting close to being out of my comfort zone.
Javaranch isn't here to help people who are hacking sites or networks.
What is the reason that you are trying to this?
+Pie Number of slices to send: Send
Thank you for your information.Actually while I was learning forward and redirect topics,it came to my mind that any one who knew a bit about programming, could bypass a filter.That is why I was testing with the forward to see if I could go to an external url.But now I see that there is a lot of work to be done and its not easy for a novice to achieve this.Anyways,thanks again for your information.
Anderson gave himself the promotion. So I gave myself this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1091 times.
Similar Threads
Mock exam tricky questions?
RequestDispatcher not throwing IllegalStateException
difference between request.getRequestDispatcher(),response.sendRedirect()
sebRedirect() can ask for the resource outside of current webapp??
jsp page redirection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:18:36.