Example usage for javax.servlet.http HttpServletResponse sendRedirect

List of usage examples for javax.servlet.http HttpServletResponse sendRedirect

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse sendRedirect.

Prototype

public void sendRedirect(String location) throws IOException;

Source Link

Document

Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.

Usage

From source file:net.bafeimao.umbrella.web.interceptor.SecurityCheckingHandlerInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    if (request.getSession().getAttribute("user") == null) {
        response.sendRedirect(request.getContextPath() + "/login?returl=" + request.getPathInfo());
        return false;
    }//from w ww  .j  ava 2s .c o  m

    return super.preHandle(request, response, handler);
}

From source file:org.valens.bamboo.servlets.AdminServlet.java

private void redirectToLogin(HttpServletRequest request, HttpServletResponse response) throws IOException {
    response.sendRedirect(this.loginUriProvider.getLoginUri(this.getUri(request)).toASCIIString());
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.authenticate.FriendController.java

private void redirectToHomePage(HttpServletResponse resp) throws IOException {
    resp.sendRedirect(UrlBuilder.getUrl("/"));
}

From source file:ke.co.tawi.babblesms.server.servlet.util.PropertiesConfig.java

/**
   * @param request // w  w w  . j a  va2 s. c  om
   * @param response 
   * @throws ServletException 
   * @throws IOException 
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.sendRedirect("index.jsp");
}

From source file:kwashc.blog.controller.RedirectController.java

@RequestMapping(value = "/redirect", method = RequestMethod.GET)
public void redirect(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    String url = req.getParameter("url");

    ClickStats.addClick(url);/*w  w  w  .j  a  va2  s.c om*/

    resp.sendRedirect(url);
}

From source file:io.github.benas.todolist.web.interceptors.SessionHandlerInterceptor.java

@Override
public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response,
        final Object handler) throws Exception {
    if (sessionData.getUser() == null) {
        response.sendRedirect("/login");
        return false;
    } else {//  ww w  .  j  a v a2s .  com
        return true;
    }
}

From source file:org.sventon.appl.ConfigAuthorizationFilter.java

private void redirectToLoginPage(HttpServletRequest request, HttpServletResponse response) throws IOException {
    logger.debug("Login required for editing config");
    response.sendRedirect(request.getContextPath() + "/repos/configlogin");
}

From source file:net.fenyo.mail4hotspot.web.OAuthServletCallback.java

@Override
protected void onSuccess(HttpServletRequest req, HttpServletResponse resp, Credential credential)
        throws ServletException, IOException {
    log.debug("ok");
    resp.sendRedirect("/");
}

From source file:io.muic.ooc.servlet.LoginServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    if (SecurityService.isAuthorized(request)) {
        response.sendRedirect("/home");
    } else {/* w w  w  .  ja  v  a 2 s  .c o  m*/
        RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/login.jsp");
        rd.include(request, response);
    }
}

From source file:com.kn.calc.controller.VKAPIController.java

@RequestMapping(value = "/vk_connection_url")
public void vkConnectionUrl(HttpServletResponse response) throws IOException {
    init();/*from w  w w.j  av a 2 s  .co  m*/
    response.sendRedirect(connectonUrl);
}