Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher  RSS feed

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to use RequestDispatcher to redirect to a new server.What I want to do is to redirect to secure server(https)
running on different port using request diaptcher.
I could do it using response.sendRedirect() but i am curious to know whether we can use RequestDispatcher
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given the architecture of servlets, I don't think that is possible. After all, the response and request already have a HTTP connection established with the existing server.
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's architecturally unfeasible, but the Servlet API 2.2 spec says that tou can only dispatch requests to local URIs.
There's nothing preventing you implementing a little bit of proxy code in your servlet to open a connection to another server and send its output to your output stream, though.
 
Look ma! I'm selling my stuff!
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!