mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -434,12 +434,11 @@ public final class AuthenticationHelper
|
|||||||
// Portal vendor has decided to encode the objects in the session
|
// Portal vendor has decided to encode the objects in the session
|
||||||
if (portalUserKeyName.get() == null)
|
if (portalUserKeyName.get() == null)
|
||||||
{
|
{
|
||||||
String userKeyPostfix = "?" + AUTHENTICATION_USER;
|
|
||||||
Enumeration enumNames = session.getAttributeNames();
|
Enumeration enumNames = session.getAttributeNames();
|
||||||
while (enumNames.hasMoreElements())
|
while (enumNames.hasMoreElements())
|
||||||
{
|
{
|
||||||
String name = (String)enumNames.nextElement();
|
String name = (String)enumNames.nextElement();
|
||||||
if (name.endsWith(userKeyPostfix))
|
if (name.endsWith(AUTHENTICATION_USER))
|
||||||
{
|
{
|
||||||
// cache the key value once found!
|
// cache the key value once found!
|
||||||
portalUserKeyName.set(name);
|
portalUserKeyName.set(name);
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.web.bean.ajax;
|
package org.alfresco.web.bean.ajax;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -135,7 +136,7 @@ public class FileUploadBean
|
|||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
is = new FileInputStream(file);
|
is = new BufferedInputStream(new FileInputStream(file));
|
||||||
encoding = Repository.guessEncoding(fc, is, mimetype);
|
encoding = Repository.guessEncoding(fc, is, mimetype);
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
|
@@ -45,6 +45,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
|
import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
|
||||||
import org.alfresco.web.scripts.WebScript;
|
import org.alfresco.web.scripts.WebScript;
|
||||||
import org.alfresco.web.scripts.WebScriptDescription;
|
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
|
public void processAction(ActionRequest req, ActionResponse res) throws PortletException, PortletSecurityException, IOException
|
||||||
{
|
{
|
||||||
|
Application.setInPortalServer(true);
|
||||||
Map<String, String[]> params = req.getParameterMap();
|
Map<String, String[]> params = req.getParameterMap();
|
||||||
for (Map.Entry<String, String[]> param : params.entrySet())
|
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
|
public void render(RenderRequest req, RenderResponse res) throws PortletException, PortletSecurityException, IOException
|
||||||
{
|
{
|
||||||
|
Application.setInPortalServer(true);
|
||||||
PortletMode portletMode = req.getPortletMode();
|
PortletMode portletMode = req.getPortletMode();
|
||||||
if (PortletMode.VIEW.equals(portletMode))
|
if (PortletMode.VIEW.equals(portletMode))
|
||||||
{
|
{
|
||||||
|
@@ -68,6 +68,8 @@ public class WebScriptPortletRequest extends WebScriptURLRequest
|
|||||||
{
|
{
|
||||||
super(scriptUrlParts, serviceMatch);
|
super(scriptUrlParts, serviceMatch);
|
||||||
this.req = req;
|
this.req = req;
|
||||||
|
if (req != null)
|
||||||
|
{
|
||||||
// look for the user info map in the portlet request - populated by the portlet container
|
// look for the user info map in the portlet request - populated by the portlet container
|
||||||
Map userInfo = (Map)req.getAttribute(PortletRequest.USER_INFO);
|
Map userInfo = (Map)req.getAttribute(PortletRequest.USER_INFO);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
@@ -86,6 +88,7 @@ public class WebScriptPortletRequest extends WebScriptURLRequest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Portlet Request
|
* Gets the Portlet Request
|
||||||
|
Reference in New Issue
Block a user