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:cn.cug.laboratory.controller.admin.AdminController.java

@RequestMapping("/toLogin")
public void login() throws IOException {
    HttpServletResponse response = getHttpServletResponse();
    response.sendRedirect("../index.jsp");
}

From source file:fi.helsinki.opintoni.security.LocalLogoutSuccessHandler.java

@Override
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws IOException {
    response.sendRedirect("/");
}

From source file:br.com.semanticwot.cd.util.RedirectAfterLogout.java

@Override
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication a)
        throws IOException, ServletException {

    response.sendRedirect(request.getContextPath());

}

From source file:edu.pitt.sis.infsci2730.finalProject.web.LogoutController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public void logout(HttpServletResponse res, HttpSession session) {
    session.invalidate();//from w  ww .ja  v a  2s  .c o m
    try {
        res.sendRedirect("/eBusiness/user");
    } catch (IOException ex) {
        Logger.getLogger(LogoutController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.davidmendoza.esu.web.ForoController.java

@RequestMapping(method = RequestMethod.GET)
public void foro(HttpServletResponse response) throws IOException {
    log.info("Reenviando a foro");
    response.sendRedirect("http://foro.escuelasabaticauniversitaria.org");
}

From source file:com.ateam.login.UserSession.java

@Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
        throws IOException, ServletException {
    HttpSession session = ((HttpServletRequest) request).getSession();
    String redirectUrl = (String) session.getAttribute(LAST_URL_REDIRECT_KEY);
    if (isAuthenticated() && (redirectUrl != null) && !redirectUrl.isEmpty()) {
        session.removeAttribute(LAST_URL_REDIRECT_KEY);
        HttpServletResponse resp = (HttpServletResponse) response;
        resp.sendRedirect(redirectUrl);
    } else {//from   w  ww .  jav  a2 s .c  o m
        chain.doFilter(request, response);
    }
}

From source file:br.com.semanticwot.cd.util.RedirectAfterLogin.java

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws IOException, ServletException {

    response.sendRedirect(request.getContextPath());
}

From source file:com.roncoo.pay.controller.filter.UserFilter.java

public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
        throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) req;
    String uri = request.getServletPath(); // 
    LOG.info("=== uri=" + uri);

    // ?//from  w  w w .j  a  v  a  2 s. c om
    RpUserInfo rpUserInfo = (RpUserInfo) request.getSession().getAttribute(ConstantClass.USER);
    // ,???
    if (uri.contains("merchant") && rpUserInfo == null) {
        HttpServletResponse response = (HttpServletResponse) res;
        response.sendRedirect(request.getContextPath() + "/login");
    } else {
        chain.doFilter(req, res);
    }
}

From source file:com.beto.test.securityinterceptor.security.MyAuthErrorHandler.java

@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException exception) throws IOException, ServletException {
    response.sendRedirect("login?error");
}

From source file:UrlRedirect.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, java.io.IOException {
    String contextPath = "http://www.java2s.com";
    response.sendRedirect(response.encodeRedirectURL(contextPath + "/maps"));
}