Example usage for com.liferay.portal.kernel.servlet NoRedirectServletResponse getRedirectLocation

List of usage examples for com.liferay.portal.kernel.servlet NoRedirectServletResponse getRedirectLocation

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet NoRedirectServletResponse getRedirectLocation.

Prototype

public String getRedirectLocation() 

Source Link

Usage

From source file:com.liferay.compat.hook.action.CompatUpdatePasswordAction.java

License:Open Source License

public String execute(StrutsAction originalStrutsAction, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    NoRedirectServletResponse noRedirectServletResponse = new NoRedirectServletResponse(response);

    String forward = originalStrutsAction.execute(request, noRedirectServletResponse);

    String location = noRedirectServletResponse.getRedirectLocation();

    if (Validator.isNotNull(location)) {
        String redirect = ParamUtil.getString(request, WebKeys.REFERER);

        if (Validator.isNull(redirect)) {
            redirect = location;//from w w w  .jav  a 2s . co m
        }

        response.sendRedirect(redirect);
    }

    return forward;
}