Redirect to external link in AppEngine java?
-
28-10-2019 - |
Question
I want to redirect to a external webpage but I don't know how to do that because in the EntryPoint I don't have Request and Response like in HttpServlets.
How can I do that?
Solution
In GWT you can use Window.Location.assign(url)
to redirect browser to a new URL. Note: browser will load new URL and your GWT app will be closed (and all data and state lost).
OTHER TIPS
This doesn't work?
package test;
import java.io.IOException;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.sendRedirect("http://www.google.com/");
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow