[gatein-commits] gatein SVN: r5058 - in portal/branches/branch-GTNPORTAL-1643: examples/extension/war/src/main/webapp/login/jsp and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 12 03:37:28 EST 2010


Author: phuong_vu
Date: 2010-11-12 03:37:26 -0500 (Fri, 12 Nov 2010)
New Revision: 5058

Modified:
   portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java
   portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java
   portal/branches/branch-GTNPORTAL-1643/examples/extension/war/src/main/webapp/login/jsp/login.jsp
   portal/branches/branch-GTNPORTAL-1643/examples/portal/war/src/main/webapp/login/jsp/login.jsp
   portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/groovy/portal/webui/UILoginForm.gtmpl
   portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/login/jsp/login.jsp
Log:
GTNPORTAL-1594 A wrong sendRedirect after login

Modified: portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java	2010-11-12 08:26:36 UTC (rev 5057)
+++ portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java	2010-11-12 08:37:26 UTC (rev 5058)
@@ -129,12 +129,12 @@
       }
       try
       {
-         req.setAttribute("org.gatein.portal.login.initial_uri", initialURI);
+         req.getSession(true).setAttribute("org.gatein.portal.login.initial_uri", initialURI);
          getServletContext().getRequestDispatcher("/login/jsp/login.jsp").include(req, resp);
       }
       finally
       {
-         req.removeAttribute("org.gatein.portal.login.initial_uri");
+         req.getSession(true).removeAttribute("org.gatein.portal.login.initial_uri");
       }
    }
 

Modified: portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java	2010-11-12 08:26:36 UTC (rev 5057)
+++ portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java	2010-11-12 08:37:26 UTC (rev 5058)
@@ -73,12 +73,13 @@
       // otherwise compute one
       if (uri == null || uri.length() == 0)
       {
-         uri = req.getContextPath() + "/private/classic";
+         uri = req.getContextPath();
          log.debug("No initial URI found, will use default " + uri + " instead ");
       }
       else
       {
          log.debug("Found initial URI " + uri);
+         req.getSession(true).setAttribute("org.gatein.portal.login.initial_uri", uri);
       }
 
       // if we do have a remember me

Modified: portal/branches/branch-GTNPORTAL-1643/examples/extension/war/src/main/webapp/login/jsp/login.jsp
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/examples/extension/war/src/main/webapp/login/jsp/login.jsp	2010-11-12 08:26:36 UTC (rev 5057)
+++ portal/branches/branch-GTNPORTAL-1643/examples/extension/war/src/main/webapp/login/jsp/login.jsp	2010-11-12 08:37:26 UTC (rev 5058)
@@ -26,6 +26,7 @@
 <%@ page import="java.util.ResourceBundle"%>
 <%@ page import="org.exoplatform.web.login.InitiateLoginServlet"%>
 <%@ page import="org.gatein.common.text.EntityEncoder"%>
+<%@ page import="javax.servlet.http.HttpSession"%>
 <%@ page language="java" %>
 <%@ page contentType="text/html; charset=utf-8" %>
 <%
@@ -40,7 +41,9 @@
   ResourceBundleService service = (ResourceBundleService) portalContainer.getComponentInstanceOfType(ResourceBundleService.class);
   ResourceBundle res = service.getResourceBundle(service.getSharedResourceBundleNames(), request.getLocale()) ;
   
-  String uri = (String)request.getAttribute("org.gatein.portal.login.initial_uri");
+   HttpSession httpSession = request.getSession(true);
+   String uri = (String)httpSession.getAttribute("org.gatein.portal.login.initial_uri");
+   httpSession.removeAttribute("org.gatein.portal.login.initial_uri");
 
   Cookie cookie = new Cookie(InitiateLoginServlet.COOKIE_NAME, "");
 	cookie.setPath(request.getContextPath());

Modified: portal/branches/branch-GTNPORTAL-1643/examples/portal/war/src/main/webapp/login/jsp/login.jsp
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/examples/portal/war/src/main/webapp/login/jsp/login.jsp	2010-11-12 08:26:36 UTC (rev 5057)
+++ portal/branches/branch-GTNPORTAL-1643/examples/portal/war/src/main/webapp/login/jsp/login.jsp	2010-11-12 08:37:26 UTC (rev 5058)
@@ -26,6 +26,7 @@
 <%@ page import="java.util.ResourceBundle"%>
 <%@ page import="org.exoplatform.web.login.InitiateLoginServlet"%>
 <%@ page import="org.gatein.common.text.EntityEncoder"%>
+<%@ page import="javax.servlet.http.HttpSession"%>
 <%@ page language="java" %>
 <%@ page contentType="text/html; charset=utf-8" %>
 <%
@@ -40,7 +41,9 @@
   ResourceBundleService service = (ResourceBundleService) portalContainer.getComponentInstanceOfType(ResourceBundleService.class);
   ResourceBundle res = service.getResourceBundle(service.getSharedResourceBundleNames(), request.getLocale()) ;
   
-  String uri = (String)request.getAttribute("org.gatein.portal.login.initial_uri");
+   HttpSession httpSession = request.getSession(true);
+   String uri = (String)httpSession.getAttribute("org.gatein.portal.login.initial_uri");
+   httpSession.removeAttribute("org.gatein.portal.login.initial_uri");
 
   Cookie cookie = new Cookie(InitiateLoginServlet.COOKIE_NAME, "");
 	cookie.setPath(request.getContextPath());

Modified: portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/groovy/portal/webui/UILoginForm.gtmpl
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/groovy/portal/webui/UILoginForm.gtmpl	2010-11-12 08:26:36 UTC (rev 5057)
+++ portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/groovy/portal/webui/UILoginForm.gtmpl	2010-11-12 08:37:26 UTC (rev 5058)
@@ -7,7 +7,7 @@
 	jsmanager.addCustomizedOnLoadScript('document.getElementById("UIPortalComponentLogin").username.focus();');
 	HttpSession session = rcontext.getRequest().getSession();
 	String requestPath = rcontext.getRequestContextPath() + "/private/" + rcontext.getPortalOwner();
-	session.setAttribute("initialURI", requestPath);
+	//session.setAttribute("initialURI", requestPath);
 %>
 <div class="UILoginForm">
 	<div class="LoginDecorator">
@@ -23,7 +23,7 @@
 				<div class="LoginDecoratorBackground">
 					<div class="LoginDetailBox">
 						<form class="UIForm" id="$uicomponent.id" name="loginForm" action="<%= rcontext.getRequestContextPath() + "/login"%>" method="post" style="margin: 0px;">
-							<input type="hidden" name="initialURI" value="<%=session.getAttribute("initialURI"); %>"/>
+							<input type="hidden" name="initialURI" value="<%=requestPath %>"/>
 							<div class="VerticalLayout">
 								<table class="UIFormGrid">
 									<tr class="UserNameField">

Modified: portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/login/jsp/login.jsp
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/login/jsp/login.jsp	2010-11-12 08:26:36 UTC (rev 5057)
+++ portal/branches/branch-GTNPORTAL-1643/web/portal/src/main/webapp/login/jsp/login.jsp	2010-11-12 08:37:26 UTC (rev 5058)
@@ -26,6 +26,7 @@
 <%@ page import="java.util.ResourceBundle"%>
 <%@ page import="org.exoplatform.web.login.InitiateLoginServlet"%>
 <%@ page import="org.gatein.common.text.EntityEncoder"%>
+<%@ page import="javax.servlet.http.HttpSession"%>
 <%@ page language="java" %>
 <%
   String contextPath = request.getContextPath() ;
@@ -44,7 +45,9 @@
 	cookie.setMaxAge(0);
 	response.addCookie(cookie);
 
-  String uri = (String)request.getAttribute("org.gatein.portal.login.initial_uri");
+  HttpSession httpSession = request.getSession(true);
+  String uri = (String)httpSession.getAttribute("org.gatein.portal.login.initial_uri");
+  httpSession.removeAttribute("org.gatein.portal.login.initial_uri");
 
   response.setCharacterEncoding("UTF-8"); 
   response.setContentType("text/html; charset=UTF-8");



More information about the gatein-commits mailing list