Redirect to Google+ with Ratpack
Tags: Ratpack
One thing that I had always wanted to do is to redirect from my domain to my Google+ profile; to have http://jameswilliams.be/+ redirect to Google+. Some folks have accomplished this by modifying their .htaccess file in Apache. I wanted to try to come up with a solution using Ratpack.
get("/\+") {
response.sendRedirect("http://profiles.google.com/105400736676917752271/posts")
}
Once I figured out how to use "+" in an endpoint(which requires escaping as listed above), it was really simple to get working: use the injected response object to send a 302 redirect to my profile. Easy peasy.