This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Redirection to a basic-authenticated page  RSS feed

David Carrascal
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all,
I have a servlet that has to redirect to a remote page (another domain, another machine) and this new page is protected under basic authentication (you know, floating window asking for user/pass)...
Well, I´ve no problem to do it, using URLConnection or Apache HttpConnection...
Then I take the response and I write it on the standard servlet output. Now I have the new remote page.

BUT my problem is that (logically) I stay in my servlet context (that means, navigator´s URL is http://mymachine:8080/myservlet ) so every link in the new remote page is not working (because they´re not absolute but relative, as expected).

Then I´m trying to do a kind of sendRedirect(), but I´m not able to put it to work. request.sendRedirect() is not working because the page is asking me again for user & pass.

I need to redirect the page (URL in navigator must be http://remotemachine:8080/whatever....) but having pass authentication.

I´ve tried:
- Ajax connection using a dinamically generated form: Ok for IE, not works in firefox (security reasons)
- Using request.setHeader(): Doesnt´work, I dunno why

¿How can I redirect to a page passing this authentication?

Thank you very much and forgive my bad English...!


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!