Merged V3.1 to HEAD

13084: Merged V2.1-A to V3.1
      7984: *RECORD-ONLY* Final part of fix for ACT 819, by default the web-client now generates WebScript content download API based URLs to allow relative paths to be resolved in HTML content files
   13086: Merged V2.1-A to V3.1
      7986: *RECORD-ONLY* Additional for ACT 819, View In Browser details page links and cm:link objects to content now output Content API webscript urls
   13090: Merged V2.1-A to V3.1
      7986: Language locale auto-selection based on browser locale - see ACT 1053
      NOTE: a web-client-config setting has been added to enable this - it is off by default.
   13093: Merged V2.1-A to V3.1
      8255: Filetypes and PanelGenerator enhancements
   13094: Merged V2.1-A to V3.1
      8547: Branding changes from Mike [just filetypes merged]
   13095: Merged V2.1-A to V3.1
      8555: Webdav path support for ExternalAccessServlet browse navigation
   13103: Merged V2.1-A to V3.1
      8592: Fix for login page issue with language locale auto-selection - see ACT 1053

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13559 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-03-11 11:16:01 +00:00
parent 3af6eec220
commit 57afebd2cd
26 changed files with 223 additions and 28 deletions

View File

@@ -28,6 +28,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.StringTokenizer;
@@ -52,6 +53,7 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.jsf.FacesContextUtils;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
@@ -197,6 +199,28 @@ public abstract class BaseServlet extends HttpServlet
}
}
/**
* Apply Client and Repository language locale based on the 'Accept-Language' request header
*/
public static Locale setLanguageFromRequestHeader(HttpServletRequest req)
{
Locale locale = null;
// set language locale from browser header
String acceptLang = req.getHeader("Accept-Language");
if (acceptLang != null && acceptLang.length() != 0)
{
StringTokenizer t = new StringTokenizer(acceptLang, ",; ");
// get language and convert to java locale format
String language = t.nextToken().replace('-', '_');
Application.setLanguage(req.getSession(), language);
locale = I18NUtil.parseLocale(language);
I18NUtil.setLocale(locale);
}
return locale;
}
/**
* Apply the headers required to disallow caching of the response in the browser
*/