The developers of the code I am deploying are passing relative urls
into sendRedirect()... I do not believe they are encoding these in any
way first.
In any case... in front of our site we are using a SSL accelerator...
and we are redirecting the output of this to a high port (11443)
instead of 443 or 80...
So the public url of our site is something like
however sendRedirect takes the relative url... lets call it
/path/someServlet
and builds something like
http://foo.bar.com:11443/path/someServlet...
note the protocol is changed to http, and the high port is appended to
the uri-stem
websphere is finding out somehow that the stream is hitting the http
server as http, not https (I don't no whether or not the SSL
accelerator actually gets into the HTTP stream and replaces the
protocol in the HTTP header) and that it is coming in on the high
port... and building the URL accordingly
problem is... the url w/ the wron gprotocol and port is not accessible
from the browser
is there some way I can manage the behaviour of sendRedirect calls so
that I may dicate which, port(if any), domain and protocol are
prepended relative urls passed ?
thanks,
sean
I had the same problem with WAS 4.0 and I solved it using the
following way. In my scenario I am calling an url across applications.
So, I need to retain the actual protocol and port (like yours).
WebSphere provides the following methods in request object.
request.getScheme() --> will provide you the protocol (http/https)
request.getServerName() ---> will provide the servername (eg.
xyz.ibm.com)
request.getServerPort() ---> will provide the port number.
request.getRequestURI() ---> will provide the uri.
With these information you can construct your absolute url before you
pass it to the sendRedirect.
ie. String direct_url =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getRequest.URI;
response.sendRedirect(direct_url);
Hope this solves your problem.
Balaji