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:com.museum_web.controller.AnnotationController.java

@RequestMapping("/actions/DeleteAnnotation/{id}")
public void deleteAnnotation(@PathVariable("id") Long id, HttpServletResponse response) throws Exception {

    as.deleteAnnotation(id);//from  w ww  .  j a v a2 s. co  m

    response.sendRedirect("../../annotation");

}

From source file:it.f2informatica.webapp.security.CustomAuthenticationFailureHandler.java

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

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

@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException exception) throws IOException, ServletException {
    response.sendRedirect(appConfiguration.get("appRelativeUrl") + "/error/accessdenied");
}

From source file:edu.usu.sdl.openstorefront.web.init.ShiroAdjustedFilter.java

@Override
protected void doFilterInternal(ServletRequest servletRequest, ServletResponse servletResponse,
        FilterChain chain) throws ServletException, IOException {
    if (servletRequest instanceof HttpServletRequest) {
        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
        String url = httpServletRequest.getRequestURL().toString();
        if (url.contains("Login.action") && url.contains(";")) {
            HttpServletResponse response = (HttpServletResponse) servletResponse;
            response.sendRedirect(httpServletRequest.getContextPath());
            return;
        }/* w  w w .ja  v  a 2  s  . c om*/

        if (url.endsWith("Login.action") == false && url.contains("/api/") == false
                && url.contains("/apidoc/") == false) {
            String queryString = httpServletRequest.getQueryString();

            if (StringUtils.isNotBlank(queryString)) {
                url = url + "?" + queryString;
            }
            httpServletRequest.getSession().setAttribute(REFERENCED_FILTER_URL_ATTRIBUTE, url);
        }
    }
    super.doFilterInternal(servletRequest, servletResponse, chain);
}

From source file:com.museum_web.controller.AnswerController.java

@RequestMapping("actions/DeleteAnswer/{id}")
public void deleteAnswer(@PathVariable("id") Long id, HttpServletResponse response) throws Exception {

    new AnswerService().deleteAnswer(id);

    response.sendRedirect("../../answer");

}

From source file:com.inkubator.securitycore.util.AuthenticationSuccessHandler.java

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws IOException {
    LOGGER.info("Success Login");
    response.sendRedirect(request.getContextPath() + "/protected/home.htm");
}

From source file:th.co.geniustree.osgi.prototype.authen.impl.AuthenServiceImpl.java

@Override
public void signIn(HttpServletResponse response, String callbackUrl) {
    try {//from   w  w  w  .jav a 2 s .co  m
        response.sendRedirect(AUTHENTICATION_URL + "?redirect_url=" + callbackUrl);
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

From source file:com.museum_web.controller.MuseumController.java

@RequestMapping("actions/deleteMuseum")
public void deleteMuseum(Museum museum, HttpServletResponse response) throws Exception {
    new MuseumService().deleteMuseum(museum.getId());
    response.sendRedirect("../museum");
}

From source file:org.osmsurround.ae.oauth.OauthRequestController.java

@RequestMapping("/oauthRequest")
public void sendOauthRequest(HttpServletResponse response) throws IOException {
    String url = oauthService.getRequestTokenUrl(response);
    response.sendRedirect(url);
}

From source file:org.primefaces.integration.swf.PrimeFacesAjaxHandler.java

public void sendAjaxRedirect(String targetURL, HttpServletRequest req, HttpServletResponse resp, boolean popup)
        throws IOException {
    if (isAjaxRequest(req, resp))
        resp.sendRedirect(targetURL);
    else//  w w w  .j  a  v  a2 s  .  com
        delegate.sendAjaxRedirect(targetURL, req, resp, popup);
}