Package javax.servlet.http

Examples of javax.servlet.http.HttpServletResponse.encodeRedirectURL()


            try
            {
                if(isRedirect())
                {
                    log.debug("Should Redirect");
                    res = response.encodeRedirectURL(uri);
                }
                else
                {
                    res = response.encodeURL(uri);
                }
View Full Code Here


    }
    requestControl.replay();

    MockControl responseControl = MockControl.createControl(HttpServletResponse.class);
    HttpServletResponse resp = (HttpServletResponse) responseControl.getMock();
    resp.encodeRedirectURL(expectedUrlForEncoding);
    responseControl.setReturnValue(expectedUrlForEncoding);
    resp.sendRedirect(expectedUrlForEncoding);
    responseControl.setVoidCallable(1);
    responseControl.replay();
View Full Code Here

        // Perform URL rewriting to include our session ID (if any)
        if (pageContext.getSession() != null) {
            HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
            if (redirect) {
                return (response.encodeRedirectURL(url.toString()));
            } else {
                return (response.encodeURL(url.toString()));
            }
        } else {
             return (url.toString());
View Full Code Here

        // Perform URL rewriting to include our session ID (if any)
        // but only if url is not an external URL
        if (( href == null ) && ( pageContext.getSession() != null )) {
            HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
            if (redirect) {
                return (response.encodeRedirectURL(url.toString()));
            } else {
                return (response.encodeURL(url.toString()));
            }
        } else {
            return (url.toString());
View Full Code Here

            redir.append(getRequestContextPath());
        }
        redir.append(url);

        HttpServletResponse rsp = getResponse();
        String dstUrl = rsp.encodeRedirectURL(redir.toString());
        rsp.sendRedirect(dstUrl);
    }

    /**
     * Look in the request and session scopes for an entry
View Full Code Here

                if (info.isExpired()) {
                    // Expired - abort processing
                    session.invalidate();

                    String targetUrl = httpRequest.getContextPath() + expiredUrl;
                    httpResponse.sendRedirect(httpResponse.encodeRedirectURL(targetUrl));

                    return;
                } else {
                    // Non-expired - update last request date/time
                    info.refreshLastRequest();
View Full Code Here

            // update the current context to the new target user
            SecurityContextHolder.getContext().setAuthentication(targetUser);

            // redirect to target url
            httpResponse.sendRedirect(httpResponse.encodeRedirectURL(httpRequest.getContextPath() + targetUrl));

            return;
        } else if (requiresExitUser(httpRequest)) {
            // get the original authentication object (if exists)
            Authentication originalUser = attemptExitUser(httpRequest);
View Full Code Here

            // update the current context back to the original user
            SecurityContextHolder.getContext().setAuthentication(originalUser);

            // redirect to target url
            httpResponse.sendRedirect(httpResponse.encodeRedirectURL(httpRequest.getContextPath() + targetUrl));

            return;
        }

        chain.doFilter(request, response);
View Full Code Here

      }
      else {
        response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
      }

      response.sendRedirect(response.encodeRedirectURL(redirectUrl));
    }

    if (!response.isCommitted()) {
      // Send 403 (we do this after response has been written)
      response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
View Full Code Here

                redirectUrl += errorPage;
            } else {
                response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
            }

            response.sendRedirect(response.encodeRedirectURL(redirectUrl));
        }

        if (!response.isCommitted()) {
            // Send 403 (we do this after response has been written)
            response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.