Redirect to Google+ with Ratpack
Posted
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.
Related Posts:
Running Ratpack inside Grails
Serving Images (Favicons) with Ratpack Middleware
Deploying a Ratpack App to a War File
Creating Autocomplete with Groovy and Ratpack
Comments
blog comments powered by Disqus