Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] redirect request to another handler or url

Is there a simple way to redirect a jetty request to another url or handler?  I'm used to django, where I could just call redirect() with the url, but I can't find a similar operation in jetty.  

This seems has been a pretty common workflow for me, where a form, for example, will submit some data to be processed and then the server will redirect the request elsewhere like the home page.  

public class ServeGame extends AbstractHandler {
    public void handle(String target,
                       Request baseRequest,
                       HttpServletRequest request,
                       HttpServletResponse response)
        throws IOException, ServletException//, TemplateException
    {
        ... do some work ...

        redirect(baseRequest, "/"); // go to the home page

    }
}

Back to the top