Fix AJAX file upload to support guess file encoding without throwing exception. Fix to MySpaces portlet in Liferay (AWC-1330). Fix to authentication issue with portlets in Liferay

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6210 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-07-11 16:23:19 +00:00
parent 4ea8311c77
commit 3588265311
4 changed files with 20 additions and 14 deletions

View File

@@ -45,6 +45,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.web.app.Application;
import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
import org.alfresco.web.scripts.WebScript;
import org.alfresco.web.scripts.WebScriptDescription;
@@ -111,6 +112,7 @@ public class WebScriptPortlet implements Portlet
*/
public void processAction(ActionRequest req, ActionResponse res) throws PortletException, PortletSecurityException, IOException
{
Application.setInPortalServer(true);
Map<String, String[]> params = req.getParameterMap();
for (Map.Entry<String, String[]> param : params.entrySet())
{
@@ -127,6 +129,7 @@ public class WebScriptPortlet implements Portlet
*/
public void render(RenderRequest req, RenderResponse res) throws PortletException, PortletSecurityException, IOException
{
Application.setInPortalServer(true);
PortletMode portletMode = req.getPortletMode();
if (PortletMode.VIEW.equals(portletMode))
{

View File

@@ -68,21 +68,24 @@ public class WebScriptPortletRequest extends WebScriptURLRequest
{
super(scriptUrlParts, serviceMatch);
this.req = req;
// look for the user info map in the portlet request - populated by the portlet container
Map userInfo = (Map)req.getAttribute(PortletRequest.USER_INFO);
if (userInfo != null)
if (req != null)
{
// look for the special Liferay email (username) key
String liferayUsername = (String)userInfo.get("user.home-info.online.email");
if (liferayUsername != null)
// look for the user info map in the portlet request - populated by the portlet container
Map userInfo = (Map)req.getAttribute(PortletRequest.USER_INFO);
if (userInfo != null)
{
// strip suffix from email address - we only need username part
if (liferayUsername.indexOf('@') != -1)
// look for the special Liferay email (username) key
String liferayUsername = (String)userInfo.get("user.home-info.online.email");
if (liferayUsername != null)
{
liferayUsername = liferayUsername.substring(0, liferayUsername.indexOf('@'));
// strip suffix from email address - we only need username part
if (liferayUsername.indexOf('@') != -1)
{
liferayUsername = liferayUsername.substring(0, liferayUsername.indexOf('@'));
}
// save in session for use by alfresco portlet authenticator
this.req.getPortletSession().setAttribute(ALFPORTLETUSERNAME, liferayUsername);
}
// save in session for use by alfresco portlet authenticator
this.req.getPortletSession().setAttribute(ALFPORTLETUSERNAME, liferayUsername);
}
}
}