Example usage for javax.servlet.http HttpServletResponse isCommitted

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

Introduction

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

Prototype

public boolean isCommitted();

Source Link

Document

Returns a boolean indicating if the response has been committed.

Usage

From source file:io.druid.server.AsyncManagementForwardingServlet.java

private void handleBadRequest(HttpServletResponse response, String errorMessage) throws IOException {
    if (!response.isCommitted()) {
        response.resetBuffer();/*from  w  ww  .j  ava  2s  .  c  o m*/
        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
        jsonMapper.writeValue(response.getOutputStream(), ImmutableMap.of("error", errorMessage));
    }
    response.flushBuffer();
}

From source file:com.devnexus.ting.security.RoleAwareSimpleUrlAuthenticationSuccessHandler.java

@Override
protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
        throws IOException, ServletException {
    String targetUrl = determineTargetUrl(request, response);

    if (response.isCommitted()) {
        logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
        return;/*from  ww w  .j  a v a2  s. c  om*/
    }

    final Collection<? extends GrantedAuthority> auths = authentication.getAuthorities();

    if (auths.size() == 1 && auths.contains("ROLE_APP_USER")) {
        super.getRedirectStrategy().sendRedirect(request, response, "/s/cfp/index");
    }

    super.getRedirectStrategy().sendRedirect(request, response, targetUrl);
}

From source file:de.thm.arsnova.CASLogoutSuccessHandler.java

@Override
public void onLogoutSuccess(final HttpServletRequest request, final HttpServletResponse response,
        final Authentication authentication) throws IOException, ServletException {
    String referer = request.getHeader("referer");
    if (response.isCommitted()) {
        LOGGER.info("Response has already been committed. Unable to redirect to target");
        return;/*from w w  w  .j  av  a2  s  . c o  m*/
    }
    redirectStrategy.sendRedirect(request, response,
            (casUrl + "/logout?url=") + (referer != null ? referer : defaultTarget));
}

From source file:org.broadleafcommerce.common.security.BroadleafAdminLogoutSuccessHandler.java

public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws IOException, ServletException {
    String targetUrl = determineTargetUrl(request, response);

    if (response.isCommitted()) {
        logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
        return;//from  w  ww . ja  v a 2  s.c om
    }

    String queryString = request.getQueryString();
    if (!StringUtils.isEmpty(queryString)) {
        targetUrl += "?" + queryString;
    }

    getRedirectStrategy().sendRedirect(request, response, targetUrl);
}

From source file:org.broadleafcommerce.openadmin.security.BroadleafAdminLogoutSuccessHandler.java

public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws IOException, ServletException {
    String targetUrl = determineTargetUrl(request, response);

    if (response.isCommitted()) {
        logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
        return;//from ww  w .ja v  a 2 s.co m
    }

    String queryString = request.getQueryString();
    if (!StringUtils.isEmpty(queryString)) {
        targetUrl += "?" + queryString;
    }

    request.getSession().invalidate();
    getRedirectStrategy().sendRedirect(request, response, targetUrl);
}

From source file:org.cms.config.CustomUrlAuthenticationSuccessHandler.java

protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
        throws IOException {

    String targetUrl = determineTargetUrl(authentication);

    if (response.isCommitted()) {
        logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
        return;//from   w ww  .  ja va  2  s  .com
    }
    redirectStrategy.sendRedirect(request, response, targetUrl);
}

From source file:br.com.jreader.util.security.URLAuthenticationSuccessHandler.java

private void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
        throws IOException {
    String targetUrl = determineTargetUrl(authentication);

    if (response.isCommitted()) {
        logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
        return;/*  w  w  w  .  jav  a  2  s.co m*/
    }
    redirectStrategy.sendRedirect(request, response, targetUrl);
}

From source file:com.sharmila.hibernatespringsecurity.authentication.MyAuthenticationSuccessHandler.java

protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
        throws IOException {
    String targetUrl = determineTargetUrl(authentication);
    if (response.isCommitted()) {
        logger.debug("Response already commited, cannot redirect to " + targetUrl);
        return;/*from  w  w w.j a v a  2s  . c  o m*/
    }
    redirectStrategy.sendRedirect(request, response, targetUrl);
}

From source file:com.iselect.web.security.CustomSuccessHandler.java

@Override
protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
        throws IOException {
    String targetUrl = determineTargetUrl(authentication);

    if (response.isCommitted()) {
        System.out.println("Can't redirect");
        return;//w ww  .ja va  2s .  co  m
    }

    redirectStrategy.sendRedirect(request, response, targetUrl);
}

From source file:configuration.AuthSuccessHandler.java

protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
        throws IOException {
    String targetUrl = determineTargetUrl(authentication);

    if (response.isCommitted()) {
        logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
        return;// www .j av  a 2s.c om
    }

    redirectStrategy.sendRedirect(request, response, targetUrl);
}