vert.x java - redirecting browser URL

2,796 views
Skip to first unread message

Osmond James

unread,
Nov 19, 2012, 4:03:28 PM11/19/12
to ve...@googlegroups.com
Hi

Is it possible to redirect a user when handling a request using the HttpServerRequest request or response?

bytor99999

unread,
Nov 19, 2012, 7:18:05 PM11/19/12
to ve...@googlegroups.com
Why would you need a redirect? Typically redirect I can see in Servlet/JSP where things get rendered on the serverside.

In vert.x I would just return something different. Or send it to a different route via the RouteMatcher code in front.

I think in vert.x a lot of things that we used in other environments aren't necessary or have different solutions/needs. You have to think differently.

Mark

Daryl Teo

unread,
Nov 19, 2012, 11:03:08 PM11/19/12
to ve...@googlegroups.com
Sometimes a redirect is necessary if that is meant to be the actual response (say, after handling a login request).

Set the "Location" http header.

Regards,
Daryl

Christian Essl

unread,
Nov 20, 2012, 2:40:54 AM11/20/12
to ve...@googlegroups.com
Set the statuscode to 301 (or a nother of the 300 "redirect" statuscodes http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) and the Location header with the new url
Reply all
Reply to author
Forward
Message has been deleted
0 new messages