Package javax.servlet.http

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


    // Process internal context prefix
    int tilde = uri.indexOf("~");
    if (tilde != -1) {
      String path = uri.substring(tilde + 1);
      response.sendRedirect(response.encodeRedirectURL(buildURI(
          request.getContextPath() + path, request.getQueryString())));
      return;
    }

    // Try to resolve node from URI (without context path).
View Full Code Here


    if (node == null && !servlets.matcher(nodePath).matches()) {
      String sourceURI = buildURI(nodePath, request.getQueryString());
      String targetURI = rewriteURI(sourceURI);
      if (!targetURI.equals(sourceURI)) {
        if (targetURI.contains("://")) {
          response.sendRedirect(response.encodeRedirectURL(targetURI));
        } else {
          response.sendRedirect(response.encodeRedirectURL(request
              .getContextPath() + targetURI));
        }
        return;
View Full Code Here

      String targetURI = rewriteURI(sourceURI);
      if (!targetURI.equals(sourceURI)) {
        if (targetURI.contains("://")) {
          response.sendRedirect(response.encodeRedirectURL(targetURI));
        } else {
          response.sendRedirect(response.encodeRedirectURL(request
              .getContextPath() + targetURI));
        }
        return;
      }
    }
View Full Code Here

      if (root == null) {
        root = Nodes.getRoot();
      }
      request.setAttribute("Root", root);
      if (node != null && root.getParent() == node) {
        response.sendRedirect(response.encodeRedirectURL(request
            .getContextPath() + root.getPath()));
        return;
      }
    }
View Full Code Here

      return;
    }

    // Redirect if trailing slash is missing for containers.
    if (node.isContainer() && !uri.endsWith("/")) {
      response.sendRedirect(response.encodeRedirectURL(buildURI(
          uri + "/", request.getQueryString())));
    } else {
      // Set node into request scope and forward to dispatcher
      request.setAttribute(Node.class.getSimpleName(), node);
      request.setAttribute(Names.JEASE_SITE_DISPATCHER, dispatcher);
View Full Code Here

        disp.forward(req, res);
        return;
      }
    }
   
    res.sendRedirect(res.encodeRedirectURL(uri));
  }

  private FormLogin getFormLogin(Login login)
    throws ServletException
  {
View Full Code Here

        // Log Info
        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)
View Full Code Here

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

      .thenReturn("/contextPath/css/bla.css")
      .thenReturn("/contextPath/images/bla.img")
      .thenReturn("/contextPath/servlet/wicket/bookmarkable/" + DummyHomePage.class.getName());
    when(request.getContextPath()).thenReturn("/contextPath");
    HttpServletResponse response = mock(HttpServletResponse.class);
    when(response.encodeRedirectURL(Matchers.anyString())).thenAnswer(new Answer<String>()
    {
      @Override
      public String answer(InvocationOnMock invocation) throws Throwable
      {
        return (String)invocation.getArguments()[0];
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

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.