List of usage examples for javax.servlet.http HttpServletRequest getLocale
public Locale getLocale();
Locale
that the client will accept content in, based on the Accept-Language header. From source file:com.sonicle.webtop.core.app.servlet.ServletHelper.java
public static Locale homogenizeLocale(HttpServletRequest request) { Locale locale = request.getLocale(); if (locale.getLanguage().equals("it")) { return new Locale("it", "IT"); } else {//from w w w . ja v a2 s . c o m return new Locale("en", "EN"); } }
From source file:com.hangum.tadpole.commons.util.RequestInfoUtils.java
/** * Return request locale// w w w .ja v a 2s . c om * * @return */ public static String getDisplayLocale() { HttpServletRequest request = RWT.getRequest(); Locale locale = request.getLocale(); return locale.getDisplayLanguage(Locale.ENGLISH); }
From source file:fr.paris.lutece.plugins.workflow.service.taskinfo.TaskInfoManager.java
/** * Get the locale/* www.j a v a 2 s . com*/ * @param request the HTTP request * @return the locale */ private static Locale getLocale(HttpServletRequest request) { Locale locale = null; if (request != null) { locale = request.getLocale(); } else { locale = I18nService.getDefaultLocale(); } return locale; }
From source file:com.adeptj.runtime.servlet.ErrorPages.java
private static void renderGenericErrorPage(HttpServletRequest req, HttpServletResponse resp) { TemplateEngine.getInstance().render(TemplateContext.builder().request(req).response(resp) .locale(req.getLocale()).template(TEMPLATE_GENERIC).build()); }
From source file:com.adeptj.runtime.servlet.ErrorPages.java
private static void render500Page(HttpServletRequest req, HttpServletResponse resp) { TemplateEngine.getInstance().render(TemplateContext.builder().request(req).response(resp) .locale(req.getLocale()).template(TEMPLATE_500).build()); }
From source file:io.adeptj.runtime.servlet.ErrorPages.java
private static void renderGenericErrorPage(HttpServletRequest req, HttpServletResponse resp) { TemplateEngines.getDefault().render(TemplateContext.builder().request(req).response(resp) .locale(req.getLocale()).template(TEMPLATE_GENERIC).build()); }
From source file:io.adeptj.runtime.servlet.ErrorPages.java
private static void render500Page(HttpServletRequest req, HttpServletResponse resp) { TemplateEngines.getDefault().render(TemplateContext.builder().request(req).response(resp) .locale(req.getLocale()).template(TEMPLATE_500).build()); }
From source file:com.adeptj.runtime.servlet.ErrorPages.java
private static void render500PageWithExceptionTrace(HttpServletRequest req, HttpServletResponse resp) { TemplateEngine// ww w. ja v a2 s . c o m .getInstance().render( TemplateContext.builder().request(req).response(resp).locale(req.getLocale()) .template(TEMPLATE_500).templateData(TemplateData.newTemplateData() .put(KEY_EXCEPTION, RequestUtil.getAttribute(req, ERROR_EXCEPTION))) .build()); }
From source file:io.adeptj.runtime.servlet.ErrorPages.java
private static void render500PageWithExceptionTrace(HttpServletRequest req, HttpServletResponse resp) { TemplateEngines/* w ww. j av a 2 s .c o m*/ .getDefault().render( TemplateContext.builder().request(req).response(resp).locale(req.getLocale()) .template(TEMPLATE_500).contextObject(ContextObject.newContextObject() .put(KEY_EXCEPTION, RequestUtil.getAttribute(req, ERROR_EXCEPTION))) .build()); }
From source file:com.adeptj.runtime.servlet.ErrorPages.java
private static void renderErrorPageForStatusCode(HttpServletRequest req, HttpServletResponse resp, String statusCode) {// www . j a va 2 s . c om TemplateEngine.getInstance().render(TemplateContext.builder().request(req).response(resp) .locale(req.getLocale()).template(String.format(TEMPLATE_ERROR_RESOLVABLE, statusCode)).build()); }