List of usage examples for java.util ResourceBundle getBundle
@CallerSensitive public static final ResourceBundle getBundle(String baseName)
From source file:com.balero.controllers.LogoutController.java
/** * Simple. Set cookie's content to 'init' * init equals to empty or null/* w w w . jav a2s. c om*/ * * @param response HTTP headers * @param redirectAttributes Show in message center * @return View */ @RequestMapping(method = RequestMethod.GET) public String logout(HttpServletResponse response, RedirectAttributes redirectAttributes) { // create cookie and set it in response Cookie cookie = new Cookie("baleroAdmin", "init"); response.addCookie(cookie); /** * Base on: * stackoverflow.com/questions/19249049/ * how-to-pass-parameters- * to-redirect-page-in-spring-mvc */ ResourceBundle bundle = ResourceBundle.getBundle("messages"); redirectAttributes.addFlashAttribute("message", bundle.getString("label.login.logout")); return "redirect:/"; }
From source file:br.com.tcc.rest.config.TccExceptionHandler.java
private String getBundleMessage(String key) { ResourceBundle bundle = ResourceBundle.getBundle("tcc-messages"); String message = key;//from w w w.jav a 2s . com if (bundle.containsKey(key)) { message = bundle.getString(key); } return message; }
From source file:com.projity.util.VersionUtils.java
public static String getVersion() { String version = null;//from w w w . j a va 2 s .c om try { ResourceBundle bundle = ResourceBundle.getBundle("org.ultimania.kanon.version"); if (bundle != null) version = bundle.getString("angelfalls.version"); } catch (Exception e) { log.error("Could not found org.ultimania.kanon.version.properties file."); } return version; }
From source file:com.siapa.managedbean.JaulaManangedBean.java
@Override public void save(ActionEvent event) { String msg = ResourceBundle.getBundle("/crudbundle").getString(Jaula.class.getSimpleName() + "Updated"); //getSelected().setIdTipoJaula(getTipoJaula()); getSelected().setListaVentaJaula(getJaulaVenta()); persist(PersistAction.UPDATE, msg);//from w ww . j a v a 2 s . co m tipoJaulaList = tipoJaulaService.findAllActives(); setSuma(this.jaulaService.sumAllJ()); toCreateJaula(); }
From source file:net.erdfelt.android.sdkfido.configer.Configer.java
public Configer(Object o) { this.obj = o; this.bub = BeanUtilsBean.getInstance(); // Setup default persistent storage file this.persistFile = new File(RC_DIR, "config.properties"); // Load descriptive definitions try {//from w w w .j a v a 2 s. com defsBundle = ResourceBundle.getBundle(o.getClass().getName()); Enumeration<String> keys = defsBundle.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (key.startsWith("scope.")) { String scope = key.substring("scope.".length()); scopes.add(scope); } } } catch (MissingResourceException e) { LOG.log(Level.WARNING, e.getMessage(), e); } // Identify all of the configurable fields walkFields(null, o.getClass(), null); // Identify the method to use for accepting raw arguments findRawArgsMethod(o.getClass()); }
From source file:de.badw.strauss.glyphpicker.controller.alltab.TeiLoadWorker.java
/** * Instantiates a new TeiLoadWorker./*from w w w. j a va 2 s.c om*/ * * @param dataSource The data source object providing the loading parameters */ public TeiLoadWorker(DataSource dataSource) { this.dataSource = dataSource; i18n = ResourceBundle.getBundle("GlyphPicker"); SAXParserFactory parserFactory = SAXParserFactoryImpl.newInstance(); try { parser = parserFactory.newSAXParser(); } catch (ParserConfigurationException e) { LOGGER.error(e); } catch (SAXException e) { LOGGER.error(e); } }
From source file:es.mityc.firmaJava.configuracion.DespliegueConfiguracionMng.java
/** * Constructor.//w w w . j a v a 2 s. c o m * * Recupera los ficheros de configuracin que se utilizarn para el despliegue */ protected DespliegueConfiguracionMng() { try { ResourceBundle rb = ResourceBundle.getBundle(ConstantesConfiguracion.STR_DESPLIEGUE); String files = rb.getString(ConstantesConfiguracion.STR_DESPLIEGUE_CONF_FILE); if (files != null) { StringTokenizer st = new StringTokenizer(files, ConstantesConfiguracion.COMA); props = new ArrayList<ResourceBundle>(st.countTokens()); boolean hasNext = st.hasMoreTokens(); while (hasNext) { String file = st.nextToken(); hasNext = st.hasMoreTokens(); try { props.add(ResourceBundle.getBundle(file)); } catch (MissingResourceException ex) { log.debug(ST_NO_RECURSOS_FILE + ConstantesConfiguracion.ESPACIO + file); } } } } catch (MissingResourceException ex) { log.debug(ConstantesConfiguracion.STR_RECURSO_NO_DISPONIBLE, ex); } }
From source file:org.alfresco.error.AlfrescoRuntimeExceptionTest.java
public void testI18NBehaviour() { // Ensure that the bundle is present on the classpath String baseResourceAsProperty = BASE_RESOURCE_NAME.replace('.', '/') + ".properties"; URL baseResourceURL = AlfrescoRuntimeExceptionTest.class.getClassLoader() .getResource(baseResourceAsProperty); assertNotNull(baseResourceURL);/*from w w w. ja v a 2 s.c om*/ baseResourceAsProperty = BASE_RESOURCE_NAME.replace('.', '/') + "_fr_FR" + ".properties"; baseResourceURL = AlfrescoRuntimeExceptionTest.class.getClassLoader().getResource(baseResourceAsProperty); assertNotNull(baseResourceURL); // Ensure we can load it as a resource bundle ResourceBundle properties = ResourceBundle.getBundle(BASE_RESOURCE_NAME); assertNotNull(properties); properties = ResourceBundle.getBundle(BASE_RESOURCE_NAME, new Locale("fr", "FR")); assertNotNull(properties); // From here on in, we use Spring // Register the bundle I18NUtil.registerResourceBundle(BASE_RESOURCE_NAME); AlfrescoRuntimeException exception1 = new AlfrescoRuntimeException(MSG_PARAMS, new Object[] { PARAM_VALUE }); assertTrue(exception1.getMessage().contains(VALUE_PARAMS)); AlfrescoRuntimeException exception3 = new AlfrescoRuntimeException(MSG_ERROR); assertTrue(exception3.getMessage().contains(VALUE_ERROR)); // Change the locale and re-test I18NUtil.setLocale(new Locale("fr", "FR")); AlfrescoRuntimeException exception2 = new AlfrescoRuntimeException(MSG_PARAMS, new Object[] { PARAM_VALUE }); assertTrue(exception2.getMessage().contains(VALUE_FR_PARAMS)); AlfrescoRuntimeException exception4 = new AlfrescoRuntimeException(MSG_ERROR); assertTrue(exception4.getMessage().contains(VALUE_FR_ERROR)); AlfrescoRuntimeException exception5 = new AlfrescoRuntimeException(NON_I18NED_MSG); assertTrue(exception5.getMessage().contains(NON_I18NED_MSG)); // MNT-13028 String param1 = PARAM_VALUE + "_1"; String param2 = PARAM_VALUE + "_2"; String param3 = PARAM_VALUE + "_3"; AlfrescoRuntimeException exception6 = new AlfrescoRuntimeException(NON_EXISTING_MSG, new Object[] { param1, param2, param3 }); String message6 = exception6.getMessage(); assertTrue(message6.contains(NON_EXISTING_MSG)); assertTrue(message6.contains(param1)); assertTrue(message6.contains(param2)); assertTrue(message6.contains(param3)); }
From source file:io.github.benas.todolist.web.servlet.user.account.ChangePasswordServlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(servletConfig.getServletContext()); userService = applicationContext.getBean(UserService.class); resourceBundle = ResourceBundle.getBundle("todolist"); //initialize JSR 303 validator ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator();/* ww w . j av a 2 s. com*/ }
From source file:org.blockfreie.element.hydrogen.murikate.ApplicationUtil.java
/** * Returns application wide resource bundle. * /*from www.j av a 2 s . com*/ * @return the resource bundle */ public static ResourceBundle messageBundle() { return ResourceBundle.getBundle(APPLICATION_MESSAGE_BUNDLE); }