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.web.mavenproject6.controller.VKController.java

@RequestMapping(value = "/vk_connection_url")
public void vkConnectionUrl(HttpServletResponse response) throws IOException {
    response.sendRedirect(connectonUrl);
}

From source file:com.hp.autonomy.hod.sso.SsoAuthenticationEntryPoint.java

/**
 * Redirects the sender of a request which has failed authentication to the SSO page
 *//*from   w  w  w .j a  va2s  .  co m*/
@Override
public void commence(final HttpServletRequest request, final HttpServletResponse response,
        final AuthenticationException authException) throws IOException, ServletException {
    response.sendRedirect(request.getContextPath() + ssoEntryPage);
}

From source file:be.fedict.eid.idp.webapp.IdPAppletServiceServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    LOG.debug("doGet");

    response.sendRedirect("./main");
}

From source file:BusinessLayer.service.MyAccessDeniedHandler.java

@Override
public void handle(HttpServletRequest request, HttpServletResponse response,
        AccessDeniedException accessDeniedException) throws IOException, ServletException {

    response.sendRedirect(accessDeniedUrl);

}

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

@RequestMapping("actions/deleteTheme")
public void deleteTheme(Theme theme, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    new ThemeService().deleteTheme(theme);
    response.sendRedirect("../theme");
}

From source file:org.osmtools.oauth.OauthRequestController.java

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

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

@RequestMapping("actions/deleteMuseological")
public void delete(MuseologicalObject museum, HttpServletResponse response) throws Exception {
    new MuseologicalObjectService().deleteObject(museum.getId());
    response.sendRedirect("../museological");
}

From source file:com.example.AuthenticationController.java

@PostMapping("/factor")
public void accept(@RequestParam String factor, Principal principal, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    if (!"red".equals(factor)) {
        response.sendRedirect("/factor?error=true");
        return;/*  w w w  .  jav a 2 s  .co  m*/
    }
    Authentication authentication = (Authentication) principal;
    Collection<GrantedAuthority> authorities = new ArrayList<>(authentication.getAuthorities());
    authorities.add(new SimpleGrantedAuthority("ROLE_FACTOR"));
    PreAuthenticatedAuthenticationToken successful = new PreAuthenticatedAuthenticationToken(
            authentication.getPrincipal(), authentication.getCredentials(), authorities);
    successful.setDetails(authentication.getDetails());
    SecurityContextHolder.getContext().setAuthentication(successful);
    handler.onAuthenticationSuccess(request, response, successful);
}

From source file:com.blackducksoftware.integration.hub.bamboo.HubBambooServlet.java

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

From source file:fr.esiea.esieaddress.controllers.login.FBLoggin.java

@RequestMapping(value = "/facebookAuthentication", method = RequestMethod.GET)
public void getFacebookLogin(HttpServletRequest request, HttpServletResponse response) {
    LOGGER.info("Send a request to facebook");

    try {// w ww  .  j  av  a 2s  .c  om
        response.sendRedirect(fbAuth.getRedirectUrl());
    } catch (IOException e) {
        LOGGER.error("Imposible to redirect the user to the facebook page login", e);
        throw new RuntimeException(e);
    }
}