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

how to return an external url with cookies

 
enric jaen
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you help me with this scenario?

short explanation

I have a servlet that receives a request from a user. The servlet then interacts with an external web on behalf the user. I would like the servlet to return at some point the current webpage and its cookies to the user so that she can continue using the external web from her browser.

sendRedirect isn't an option because the user loses the cookies, and because I don't want the browser makes a request, just show the same page that the servlet had.



long explanation

Timely the situation is:

t1)

user sends request to myservlet

browser url: localhost:8080/myservlet
browser window: <empty>
browser cookies: <empty>


t2)
servlet receives request.
servlet interacts with and external web web1Url
servlet returns web1 Html +web1 cookies to client

t3)

user receives response from servlet:

browser url: localhost:8080/myservlet
browser window: web1Html
browser cookies: web1Cookies


The problem in that at t3 is that the browser'url points to localhost, not to web1Url. I.e. what I would need at timestamp3 is something such as:

browser url: web1Url
browser window: web1Html
browser cookies: web1Cookies


sendRedirect isn't an option because it loses the web1 cookies.


Any idea how to do it?

If you need any clarification let me know.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic