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.vlabs.umt.ui.servlet.ThirdPartyLoginServlet.java

/**
 * ?/*from  ww w .j a v  a 2s . co m*/
 * */
public void doUafRequest(HttpServletRequest request, HttpServletResponse response) {
    try {
        response.sendRedirect(config.getStringProp("uaf.login.url", ""));
    } catch (IOException e) {
        LOGGER.error(e.getMessage(), e);
    }
}

From source file:cn.vlabs.umt.ui.servlet.ThirdPartyLoginServlet.java

/**
 * ?/*w  ww  .  j  a  va2s .co m*/
 * @param request
 * @param response
 */
private void doCasSsoRequest(HttpServletRequest request, HttpServletResponse response) {
    try {
        response.sendRedirect(RequestUtil.getContextPath(request) + "/cashq");
    } catch (IOException e) {
        LOGGER.error(e.getMessage(), e);
    }
}

From source file:cmg.org.monitor.services.google.OAuth2CallbackServlet.java

@Override
protected void onSuccess(HttpServletRequest request, HttpServletResponse response, Credential credential)
        throws ServletException, IOException {
    response.sendRedirect("/");
}

From source file:MyServlet.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, java.io.IOException {

    HttpSession session = request.getSession(false);
    if (session == null) {
        response.sendRedirect("/dbproj/login.jsp");
    } else {/* w ww .j av a2 s  .  co m*/
        response.sendRedirect("/dbproj/menu.jsp");
    }

}

From source file:com.pkrete.locationservice.admin.controller.mvc.LoginController.java

@RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    if (((HttpServletRequest) request).getSession().isNew()) {
        response.sendRedirect("index.htm");
    }//from   w  ww.j a v a  2 s .  c om

    return new ModelAndView("login");
}

From source file:com.logica.SArchivo.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods./*ww  w.  ja  v  a2s .  com*/
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.sendRedirect("/SitioWeb/Admin/CargarArchivo.jsp");
}

From source file:edu.emory.cci.aiw.cvrg.eureka.servlet.filter.UserFilter.java

private void goHome(HttpServletRequest inRequest, HttpServletResponse inResponse) throws IOException {
    inResponse.sendRedirect(inRequest.getContextPath() + "/logout?goHome=true");
}

From source file:bixo.fetcher.RedirectResponseHandler.java

@Override
public void handle(String pathInContext, Request baseRequest, HttpServletRequest request,
        HttpServletResponse response) throws HttpException, IOException {
    if (pathInContext.equalsIgnoreCase(_originalPath)) {
        response.sendRedirect(_redirectUrl);
    } else if (_redirectUrl.contains(pathInContext)) {
        response.setStatus(HttpStatus.SC_OK);
        response.setContentType("text/plain");

        String content = "redirected content";
        response.setContentLength(content.length());
        response.getOutputStream().write(content.getBytes());
    } else {/*from  w  w w  .j a  v  a 2 s  .c  om*/
        response.setStatus(HttpStatus.SC_OK);
        response.setContentType("text/plain");

        String content = "other content";
        response.setContentLength(content.length());
        response.getOutputStream().write(content.getBytes());
    }
}

From source file:gov.nih.nci.firebird.web.interceptor.FirebirdShowSplashPageInterceptor.java

private void redirectUserToTargetUrl(ActionInvocation actionInvocation) throws IOException {
    String targetUrl = (String) actionInvocation.getInvocationContext().getSession().remove(TARGET_URL_KEY);
    HttpServletResponse response = ServletActionContext.getResponse();
    response.sendRedirect(targetUrl);
}

From source file:org.freeeed.search.web.interceptors.SessionInterceptor.java

private void redirectToLoginRequired(HttpServletResponse res) throws IOException {
    String url = res.encodeRedirectURL(WebConstants.LOGIN_REQUIRED_PAGE);
    res.sendRedirect(url);
}