Package javax.servlet.http

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


    HttpServletResponse res = (HttpServletResponse) response;

    String queryString = req.getQueryString();

    if (queryString == null)
      res.sendRedirect(res.encodeURL(_url));
    else if (_url.indexOf('?') < 0)
      res.sendRedirect(res.encodeURL(_url + '?' + queryString));
    else
      res.sendRedirect(res.encodeURL(_url + '&' + queryString));
  }
View Full Code Here


    String queryString = req.getQueryString();

    if (queryString == null)
      res.sendRedirect(res.encodeURL(_url));
    else if (_url.indexOf('?') < 0)
      res.sendRedirect(res.encodeURL(_url + '?' + queryString));
    else
      res.sendRedirect(res.encodeURL(_url + '&' + queryString));
  }
}
View Full Code Here

    if (queryString == null)
      res.sendRedirect(res.encodeURL(_url));
    else if (_url.indexOf('?') < 0)
      res.sendRedirect(res.encodeURL(_url + '?' + queryString));
    else
      res.sendRedirect(res.encodeURL(_url + '&' + queryString));
  }
}
View Full Code Here

    String secureHostName = req.getServerName();

    if (host != null && host.getSecureHostName() != null)
      secureHostName = host.getSecureHostName();
   
    res.sendRedirect(res.encodeURL("https://" + secureHostName + path));
  }
}
View Full Code Here

        if (log.isInfoEnabled())
            log.info("Redirecting request from " + req.getRequestURI() + " to " + url.toString());
        // Redirect
        HttpServletResponse response = ServletActionContext.getResponse();
        String redirectURL = response.encodeRedirectURL(url.toString());
        response.sendRedirect( redirectURL );
        return NONE;
    }

    private String redirectPortletRequest(PortletRequest req, String target, boolean appendSourceUri)
      throws IOException
View Full Code Here

        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

                this.classLoaderWriter.delete("/org/apache/jsp");
                if ( rctxt != null ) {
                    renewJspRuntimeContext();
                }

                res.sendRedirect(path + "?reset");
                return;
            } else if ( req.getMethod().equals("GET") ) {
                final PrintWriter pw = res.getWriter();
                pw.println("<h1>Apache Sling JSP Scripting</h1>");
                pw.println("<br/>");
View Full Code Here

        response.resetBuffer();
        expectLastCall().once();

        // The request should be redirected to the context root rather than the
        // passing the parameter directly
        response.sendRedirect(cmpEq(contextPath));

        // Replay the mocks
        replay(request);
        replay(response);
        replay(authenticationInfo);
View Full Code Here

                    ext = "";
                } else if(ext.length() > 0) {
                    ext = "." + ext;
                }
                final String path = request.getContextPath() + job.getPath() + ext;
                response.sendRedirect(path);
            } catch (org.apache.sling.api.resource.LoginException e) {
                throw new ServletException("LoginException in doFilter", e);
            }
        } else {
            chain.doFilter(sreq, sresp);
View Full Code Here

        EasyMock.expect(mockRequest.getSession()).andReturn(internalSession).anyTimes();
       
        EasyMock.expect(mockResponse.encodeRedirectURL("http://localhost/loginpage")).andReturn("http://localhost/loginpage").atLeastOnce();
       
        try {
      mockResponse.sendRedirect("http://localhost/loginpage");
    } catch (IOException e) {
      fail(e.getMessage());
    }
        EasyMock.expectLastCall();
       
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.