File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirection to a basic-authenticated page

 
David Salaete
Greenhorn
Posts: 19
  • 0
  • 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...!

David


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic