Package javax.servlet.http

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


        try
        {
          // send redirect - this will discard POST parameters if the request is POST
          // - still better than getting an error because of lacking trailing slash
          httpServletResponse.sendRedirect(httpServletResponse.encodeRedirectURL(redirectURL));
        }
        catch (IOException e)
        {
          throw new RuntimeException(e);
        }
View Full Code Here


                    provider.setAbsoluteURL(location);
                } else {
                    provider.setFullPath(location);
                }
                location =
                redirectResponse.encodeRedirectURL(provider.toString());
                //redirectResponse.sendRedirect(location);
                redirectLocation = location;
                redirected = true;
            }
        } else {
View Full Code Here

        redirect.append(req.getRequestURI());
        redirect.setLength(redirect.length() - req.getPathInfo().length());
        redirect.append("index.jsp?query=");
        // rewrite it
        redirect.append(url);
        res.sendRedirect(res.encodeRedirectURL(url));
      }
    }

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

    throws IOException {

    HttpServletResponse response = requestContext.getHttpResponse ();

    String path = url.getPath ();
    path = response.encodeRedirectURL (path);
    url.setPath (path);

    response.sendRedirect (url.getExternalForm ());
  }
View Full Code Here

            // add the anchor
            if (anchor != null) {
                tmpLocation.append('#').append(anchor);
            }

            finalLocation = response.encodeRedirectURL(tmpLocation.toString());
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Redirecting to finalLocation " + finalLocation);
        }
View Full Code Here

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

    HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
    when(webRequest.getContainerRequest()).thenReturn(httpServletRequest);
    when(httpServletRequest.getCharacterEncoding()).thenReturn("UTF-8");

    HttpServletResponse httpServletResponse = mock(HttpServletResponse.class);
    when(httpServletResponse.encodeRedirectURL(Matchers.eq(url))).thenReturn(url);
    StringWriter writer = new StringWriter();
    when(httpServletResponse.getWriter()).thenReturn(new PrintWriter(writer));

    ServletWebResponse webResponse = new ServletWebResponse(webRequest, httpServletResponse);
    webResponse.sendRedirect(url);
View Full Code Here

    ServletWebRequest webRequest = mock(ServletWebRequest.class);
    when(webRequest.isAjax()).thenReturn(Boolean.FALSE);

    HttpServletResponse httpServletResponse = mock(HttpServletResponse.class);
    when(httpServletResponse.encodeRedirectURL(Matchers.eq(url))).thenReturn(url);

    ServletWebResponse webResponse = new ServletWebResponse(webRequest, httpServletResponse);
    webResponse.sendRedirect(url);

    verify(httpServletResponse).sendRedirect(url);
View Full Code Here

        private void redirect(RequestContext context)
        {
            HttpServletResponse response = context.getResponse();

            String finalURL = response.encodeRedirectURL(_location);

            try
            {
                response.sendRedirect(finalURL);
            }
View Full Code Here

      HttpServletResponse response =
    (HttpServletResponse) pageContext.getResponse();
      try {
                if (path.startsWith("/"))
                    path = request.getContextPath() + path;
    response.sendRedirect(response.encodeRedirectURL(path));
      } catch (Exception e) {
                RequestUtils.saveException(pageContext, e);
    throw new JspException
        (messages.getMessage("forward.redirect",
           name, e.toString()));
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.