mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V4.0-BUG-FIX to HEAD
37586: ALF-14309: Cannot run project using Alfresco SDK - sdk-common target now depends on sdk-extras target 37604: Merged V3.4-BUG-FIX to V4.0-BUG-FIX 37573: Merged DEV to V3.4-BUG-FIX (with improvements) 37547: ALF-13621: Encoding issue in passwords for webscript and webdav authentication Validation of BASIC username, password using following encoding in a sequence, ignoring duplicate decodings 1. UTF-8 (skip if fails to decode) 2. System.getProperty("file.encoding") (platform default encoding) 3. ISO-8859-1 It succeeds if one of them succeeds. 37591: ALF-14457: Merged PATCHES/V3.4.8 to V3.4-BUG-FIX 37288: ALF-14315: Localname is too long when upgrading from 3.1 to 3.4.8 or 3.4.9 - Truncate migrated group names within QName.MAX_LENGTH whilst maintaining uniqueness 37392: ALF-14315: Localname is too long when upgrading from 3.1 to 3.4.8 or 3.4.9 - Prevent NPE when re-parenting exising users 37593: (RECORD ONLY) Incremented version revision for 3.4.11 37599: Make this class compile so I can import all projects into Eclipse! 37601: ALF-14462: Stop Kerberos authentication from barfing when it comes across a NegoEx SPNEGO request from Windows 7 / 2008 http://blogs.msdn.com/b/openspecification/archive/2011/07/01/a-quick-look-at-the-new-negotiation-mechanism-negoex-used-with-spnego-in-windows-7.aspx 37602: ALF-10785: Locale not forwarded in webscripts when using Kerberos SSO - Previous solution didn't work when failover manual login form was used (as Accept-Language header wasn't always sent by all Surf machinery) and would also mean Share wasn't responsive to browser locale changes, unlike when using the /s endpoint. - Now we use a more foolproof solution on the /wcs endpoint - Session initiation (as detected by an authentication filter) sets an attribute that decides whether a session 'sticky' locale should be used for the rest of the session - It's set to false if a webscript is the first to access it or the session was established by a ticket. This means the Accept-Language header will drive the rest of the session. - This also means Explorer can still control the locale of a session initiated by it - Glad to see the back of this long-running bug. The good news is I now have a Kerberos EC2 image! 37603: ALF-14462: Fixed same potential NegoEx problem in Share SSOAuthenticationFilter (although not observed) 37605: Merged V3.4-BUG-FIX to V4.0-BUG-FIX (RECORD ONLY) 37590: Merged V4.0-BUG-FIX to V3.4-BUG-FIX 37586: ALF-14309: Cannot run project using Alfresco SDK git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37606 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -69,6 +69,7 @@ import org.springframework.web.jsf.FacesContextUtils;
|
||||
public class Application
|
||||
{
|
||||
private static final String LOCALE = "locale";
|
||||
private static final String USE_SESSION_LOCALE = "USE_SESSION_LOCALE";
|
||||
|
||||
public static final String BEAN_CONFIG_SERVICE = "webClientConfigService";
|
||||
public static final String BEAN_DATA_DICTIONARY = "dataDictionary";
|
||||
@@ -741,6 +742,7 @@ public class Application
|
||||
|
||||
// clear the current message bundle - so it's reloaded with new locale
|
||||
context.getExternalContext().getSessionMap().remove(MESSAGE_BUNDLE);
|
||||
context.getExternalContext().getSessionMap().put(USE_SESSION_LOCALE, Boolean.TRUE);
|
||||
|
||||
// Set the current locale in the server thread
|
||||
I18NUtil.setLocale(locale);
|
||||
@@ -759,6 +761,7 @@ public class Application
|
||||
|
||||
session.setAttribute(LOCALE, locale);
|
||||
session.removeAttribute(MESSAGE_BUNDLE);
|
||||
session.setAttribute(USE_SESSION_LOCALE, Boolean.TRUE);
|
||||
|
||||
// Set the current locale in the server thread
|
||||
I18NUtil.setLocale(locale);
|
||||
@@ -773,44 +776,59 @@ public class Application
|
||||
*/
|
||||
public static Locale getLanguage(FacesContext fc)
|
||||
{
|
||||
Locale locale = (Locale)fc.getExternalContext().getSessionMap().get(LOCALE);
|
||||
Map sessionMap = fc.getExternalContext().getSessionMap();
|
||||
Boolean useSessionLocale = (Boolean)sessionMap.get(USE_SESSION_LOCALE);
|
||||
if (useSessionLocale == null)
|
||||
{
|
||||
useSessionLocale = Boolean.TRUE;
|
||||
sessionMap.put(USE_SESSION_LOCALE, useSessionLocale);
|
||||
}
|
||||
Locale locale = (Locale)sessionMap.get(LOCALE);
|
||||
if (locale == null)
|
||||
{
|
||||
// first check saved user preferences
|
||||
String strLocale = null;
|
||||
if (getCurrentUser(fc) != null)
|
||||
if (useSessionLocale)
|
||||
{
|
||||
strLocale = (String)PreferencesService.getPreferences(fc).getValue(
|
||||
UserPreferencesBean.PREF_INTERFACELANGUAGE);
|
||||
if (strLocale != null)
|
||||
// first check saved user preferences
|
||||
String strLocale = null;
|
||||
if (getCurrentUser(fc) != null)
|
||||
{
|
||||
locale = I18NUtil.parseLocale(strLocale);
|
||||
strLocale = (String)PreferencesService.getPreferences(fc).getValue(
|
||||
UserPreferencesBean.PREF_INTERFACELANGUAGE);
|
||||
if (strLocale != null)
|
||||
{
|
||||
locale = I18NUtil.parseLocale(strLocale);
|
||||
}
|
||||
else
|
||||
{
|
||||
// failing that, use the server default locale
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// failing that, use the server default locale
|
||||
locale = Locale.getDefault();
|
||||
// else get from web-client config - the first item in the configured list of languages
|
||||
Config config = Application.getConfigService(fc).getConfig("Languages");
|
||||
LanguagesConfigElement langConfig = (LanguagesConfigElement)config.getConfigElement(
|
||||
LanguagesConfigElement.CONFIG_ELEMENT_ID);
|
||||
List<String> languages = langConfig.getLanguages();
|
||||
if (languages != null && languages.size() != 0)
|
||||
{
|
||||
locale = I18NUtil.parseLocale(languages.get(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
// failing that, use the server default locale
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
}
|
||||
// save in user session
|
||||
sessionMap.put(LOCALE, locale);
|
||||
}
|
||||
else
|
||||
{
|
||||
// else get from web-client config - the first item in the configured list of languages
|
||||
Config config = Application.getConfigService(fc).getConfig("Languages");
|
||||
LanguagesConfigElement langConfig = (LanguagesConfigElement)config.getConfigElement(
|
||||
LanguagesConfigElement.CONFIG_ELEMENT_ID);
|
||||
List<String> languages = langConfig.getLanguages();
|
||||
if (languages != null && languages.size() != 0)
|
||||
{
|
||||
locale = I18NUtil.parseLocale(languages.get(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
// failing that, use the server default locale
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
// Get the request default, already decoded from the request headers
|
||||
locale = I18NUtil.getLocale();
|
||||
}
|
||||
// save in user session
|
||||
fc.getExternalContext().getSessionMap().put(LOCALE, locale);
|
||||
}
|
||||
return locale;
|
||||
}
|
||||
@@ -826,10 +844,16 @@ public class Application
|
||||
*/
|
||||
public static Locale getLanguage(HttpSession session, boolean useInterfaceLanguage)
|
||||
{
|
||||
Boolean useSessionLocale = (Boolean)session.getAttribute(USE_SESSION_LOCALE);
|
||||
if (useSessionLocale == null)
|
||||
{
|
||||
useSessionLocale = useInterfaceLanguage;
|
||||
session.setAttribute(USE_SESSION_LOCALE, useSessionLocale);
|
||||
}
|
||||
Locale locale = (Locale)session.getAttribute(LOCALE);
|
||||
if (locale == null)
|
||||
{
|
||||
if (useInterfaceLanguage)
|
||||
if (useSessionLocale)
|
||||
{
|
||||
// first check saved user preferences
|
||||
String strLocale = null;
|
||||
@@ -852,15 +876,17 @@ public class Application
|
||||
// else get from web-client config - the first item in the configured list of languages
|
||||
locale = getLanguage(WebApplicationContextUtils.getRequiredWebApplicationContext(session
|
||||
.getServletContext()));
|
||||
|
||||
}
|
||||
|
||||
// This is an interface session - the same locale will be used for the rest of the session
|
||||
session.setAttribute(LOCALE, locale);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the request default, already decoded from the request headers
|
||||
locale = I18NUtil.getLocale();
|
||||
}
|
||||
// save in user session
|
||||
session.setAttribute(LOCALE, locale);
|
||||
}
|
||||
return locale;
|
||||
}
|
||||
@@ -932,11 +958,14 @@ public class Application
|
||||
Locale locale = (Locale)session.getAttribute(LOCALE);
|
||||
if (locale == null)
|
||||
{
|
||||
locale = Locale.getDefault();
|
||||
bundle = ResourceBundleWrapper.getResourceBundle(MESSAGE_BUNDLE, I18NUtil.getLocale());
|
||||
}
|
||||
bundle = ResourceBundleWrapper.getResourceBundle(MESSAGE_BUNDLE, locale);
|
||||
|
||||
session.setAttribute(MESSAGE_BUNDLE, bundle);
|
||||
else
|
||||
{
|
||||
// Only cache the bundle if/when we have a session locale
|
||||
bundle = ResourceBundleWrapper.getResourceBundle(MESSAGE_BUNDLE, locale);
|
||||
session.setAttribute(MESSAGE_BUNDLE, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
return bundle;
|
||||
@@ -963,11 +992,14 @@ public class Application
|
||||
Locale locale = (Locale)session.get(LOCALE);
|
||||
if (locale == null)
|
||||
{
|
||||
locale = Locale.getDefault();
|
||||
bundle = ResourceBundleWrapper.getResourceBundle(MESSAGE_BUNDLE, I18NUtil.getLocale());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only cache the bundle if/when we have a session locale
|
||||
bundle = ResourceBundleWrapper.getResourceBundle(MESSAGE_BUNDLE, locale);
|
||||
session.put(MESSAGE_BUNDLE, bundle);
|
||||
}
|
||||
bundle = ResourceBundleWrapper.getResourceBundle(MESSAGE_BUNDLE, locale);
|
||||
|
||||
session.put(MESSAGE_BUNDLE, bundle);
|
||||
}
|
||||
|
||||
return bundle;
|
||||
|
Reference in New Issue
Block a user