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:fr.paris.lutece.plugins.pluginwizard.web.PluginWizardApp.java
/** * The creation form of a business class * * @param request The Http Request/*from w ww .j av a 2 s. c o m*/ * @return The html code of the creation of a business class */ @View(VIEW_CREATE_BUSINESS_CLASS) public XPage getCreateBusinessClass(HttpServletRequest request) { _businessClass = (_businessClass != null) ? _businessClass : new BusinessClassFormBean(); Map<String, Object> model = getPluginModel(); model.put(MARK_BUSINESS_CLASS, _businessClass); return getXPage(TEMPLATE_CREATE_BUSINESS_CLASS, request.getLocale(), model); }
From source file:fr.paris.lutece.plugins.pluginwizard.web.PluginWizardApp.java
/** * The modification form of the plugin description * * @param request The Http Request/* w w w.jav a 2s. c o m*/ * @return The html code of the creation of plugin description */ @View(VIEW_MODIFY_DESCRIPTION) public XPage getModifyPluginDescription(HttpServletRequest request) { Map<String, Object> model = getPluginModel(); _description = (_description != null) ? _description : ModelService.getDescription(_nPluginId); model.put(MARK_PLUGIN_MODEL, _description); return getXPage(TEMPLATE_MODIFY_PLUGIN_DESCRIPTION, request.getLocale(), model); }
From source file:fr.paris.lutece.plugins.pluginwizard.web.PluginWizardApp.java
/** * The management screen of business classes associated to the plugin which * is generated/*from w ww . ja va2 s .com*/ * * @param request The Http Request * @return The html code of the management screen of the business classes */ @View(VIEW_MANAGE_BUSINESS_CLASSES) public XPage getManageBusinessClasses(HttpServletRequest request) { Map<String, Object> model = getModel(); model.put(MARK_PLUGIN_ID, Integer.toString(_nPluginId)); model.put(MARK_BUSINESS_CLASSES, ModelService.getPluginModel(_nPluginId).getBusinessClasses()); return getXPage(TEMPLATE_MANAGE_BUSINESS_CLASSES, request.getLocale(), model); }
From source file:fr.paris.lutece.plugins.pluginwizard.web.PluginWizardApp.java
/** * The management of the plugin applications associated to the generated * plugin//from ww w . ja va 2 s . co m * * @param request The Http Request * @return The XPage */ @View(VIEW_MANAGE_APPLICATIONS) public XPage getManageApplications(HttpServletRequest request) { Map<String, Object> model = getModel(); model.put(MARK_PLUGIN_ID, Integer.toString(_nPluginId)); model.put(MARK_PLUGIN_APPLICATIONS, ModelService.getPluginModel(_nPluginId).getApplications()); return getXPage(TEMPLATE_MANAGE_PLUGIN_APPLICATIONS, request.getLocale(), model); }
From source file:fr.paris.lutece.plugins.calendar.web.CalendarApp.java
/** * Get user options from the request parameter or stored in the session or * in cookies//ww w .ja va 2s . co m * @param request The HTTP request * @return A CalendarUserOptions */ private CalendarUserOptions getUserOptions(HttpServletRequest request) { CalendarUserOptions options = new CalendarUserOptions(); options.setLocale(request.getLocale()); options.setDayOffDisplayed(true); return options; }
From source file:es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarControllerImpl.java
/** * @see es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarController#cargaFormularoLicencias(org.apache.struts.action.ActionMapping, * es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.CargaFormularoLicenciasForm, * javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) *//*from www. j a v a 2 s . c o m*/ public final void cargaFormularoLicencias(ActionMapping mapping, es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.CargaFormularoLicenciasForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { boolean disponible = true; try { if (logger.isDebugEnabled()) logger.debug("Cargando formulario licencias"); // Los idiomas del buscador // el combo lo mostramos en el idioma de navegacin, pero en la // consolidacin habr que guardarlo en ingls String[] menCombos = new String[] { getPropertyValue("combo.tipoLicencias") }; TerminoVO[] licencias = this.getSrvVocabulariosControladosService().obtenerCombos(menCombos, LdapUserDetailsUtils.getIdioma())[0].getTerminos(); licencias = ordena(licencias, LdapUserDetailsUtils.getIdioma()); if (logger.isDebugEnabled()) logger.debug("vocabularios obtenidos, idioma: " + request.getLocale().getLanguage()); form.setLicenciasAsArray(licencias); // la licencia seleccionada form.setTipo_licencia(this.getPublicarSession(request).getTipoLicencia()); if ((this.getPublicarSession(request).getUniversal() .compareTo(getPropertyValue("licencia.acceso.universal"))) == 0) form.setAmbito_todas("1"); else form.setAmbito_todas("0"); SrvNodoService nodos = this.getSrvNodoService(); // Cargamos la lista de NODOS con los nodos dados de alta. // Hay que tener en cuenta los nodos que ya tenga el propio ODE, // para que aparezcan seleccionados. No va a aparecer el nodo local if (nodos != null) { // Ahora llamamos al mapero que me dice cuantos de los nodos de // la lista estan licenciados if (logger.isDebugEnabled()) logger.debug("Vamos a listar los nodos con las licencias impresas"); form.setComunidadesAsArray(mapeaArrayNodoVOToNodoVOODE(nodos.listarNodos(), this.getPublicarSession(request).getComunidades())); } else { if (logger.isDebugEnabled()) logger.error("No hay servicio de nodos cargando licencias"); disponible = false; } } catch (Exception ex) { logger.error("Error cargando licencias. ", ex); if (disponible) throw new ValidatorException("{gestorFlujo.error.inesperado}"); else throw new ValidatorException("{gestorFlujo.agregarLicencia.noDisponible}"); } }
From source file:fr.paris.lutece.plugins.pluginwizard.web.PluginWizardApp.java
/** * The management screen of the admin features * * @param request The Http Request/* ww w . ja va2s.co m*/ * @return The html code of the admin features */ @View(VIEW_MANAGE_ADMIN_FEATURES) public XPage getManageAdminFeatures(HttpServletRequest request) { PluginModel pm = ModelService.getPluginModel(_nPluginId); Map<String, Object> model = getModel(); model.put(MARK_PLUGIN_ID, Integer.toString(_nPluginId)); model.put(MARK_ADMIN_FEATURES, pm.getFeatures()); return getXPage(TEMPLATE_MANAGE_ADMIN_FEATURES, request.getLocale(), model); }
From source file:fr.paris.lutece.plugins.extend.modules.favorite.web.component.FavoriteResourceExtenderComponent.java
/** * {@inheritDoc}/* www . j a va 2s . c om*/ */ @SuppressWarnings("deprecation") @Override public String getPageAddOn(String strIdExtendableResource, String strExtendableResourceType, String strParameters, HttpServletRequest request) { LuteceUser user = SecurityService.getInstance().getRegisteredUser(request); Favorite favorite = _favoriteService.findByResource(strIdExtendableResource, strExtendableResourceType); String strTemplateContent = DatabaseTemplateService .getTemplateFromKey(FavoriteConstants.MARK_EXTEND_FAVORITE); Map<String, Object> model = new HashMap<String, Object>(); model.put(FavoriteConstants.MARK_FAVORITE, favorite); model.put(FavoriteConstants.MARK_ID_EXTENDABLE_RESOURCE, strIdExtendableResource); model.put(FavoriteConstants.MARK_EXTENDABLE_RESOURCE_TYPE, strExtendableResourceType); model.put(FavoriteConstants.MARK_SHOW, fetchShowParameter(strParameters)); if (user != null) { model.put(FavoriteConstants.MARK_CAN_FAVORITE, true); model.put(FavoriteConstants.MARK_FAVORITE_CLOSED, false); model.put(FavoriteConstants.MARK_CAN_DELETE_FAVORITE, isFavoriteer(user, strIdExtendableResource, strExtendableResourceType)); } else { model.put(FavoriteConstants.MARK_CAN_FAVORITE, false); model.put(FavoriteConstants.MARK_FAVORITE_CLOSED, true); } model.put(FavoriteConstants.MARK_FAVORITE_HTML_CONTENT, AppTemplateService .getTemplateFromStringFtl(strTemplateContent, request.getLocale(), model).getHtml()); HtmlTemplate template = AppTemplateService.getTemplate(TEMPLATE_FAVORITE, request.getLocale(), model); return template.getHtml(); }