Skip to main content

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

response.sendRedirect seems to be what you are after.


On Fri, Jun 28, 2013 at 6:21 AM, Josh Stratton <strattonbrazil@xxxxxxxxx> wrote:
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

    }
}

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top