Changeset 446
- Timestamp:
- 04/02/12 17:01:12 (12 years ago)
- Location:
- tapas
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/common/implementation/com/ether/EtherHelper.java
r423 r446 17 17 import java.util.ArrayList; 18 18 import java.util.List; 19 import java.util.Locale; 19 20 import java.util.Random; 21 import java.util.ResourceBundle; 20 22 21 23 /** … … 226 228 } 227 229 } 230 231 /** 232 * This method return the text corresponding to the code in the files messages**.properties 233 * 234 * @param code 235 * @param locale 236 * @return 237 */ 238 public static String getMessage( @NotNull final String code, @Nullable final Locale locale ) 239 { 240 ResourceBundle bundle = ResourceBundle.getBundle( "messages", Locale.ENGLISH ); 241 if( null != locale ) 242 bundle = ResourceBundle.getBundle( "messages", locale ); 243 244 return bundle.getString( code ); 245 } 246 228 247 } -
tapas/web/src/com/ether/Controller.java
r445 r446 33 33 * @throws WebException 34 34 */ 35 //@ControllerMethod(view = VIEW_FORM_TAPAS, loginMandatory = true, defaultView = VIEW_INDEX) 36 @ControllerMethod(view = VIEW_FORM_TAPAS, loginMandatory = false, defaultView = VIEW_INDEX) 35 @ControllerMethod(view = VIEW_FORM_TAPAS, loginMandatory = true, defaultView = VIEW_INDEX) 37 36 public JSONObject viewForm() 38 37 throws WebException -
tapas/web/src/com/ether/ControllerEther.java
r445 r446 74 74 } 75 75 76 /**77 * This method return the text from the files messages**.properties78 *79 * @param code80 * @return81 */82 public String getMessage( @NotNull final String code )83 {84 final String webInfPath = getServletContext().getRealPath( "WEB-INF" );85 return WebHelper.getMessage( webInfPath, code );86 }87 88 76 @Override 89 77 @Nullable … … 97 85 98 86 request.setCharacterEncoding( UTF8Charset.getEncoding() ); 99 // String message = getMessage( "bo.fulltitle" );100 87 101 88 // Get method to call -
tapas/web/src/com/ether/WebHelper.java
r445 r446 8 8 import org.jetbrains.annotations.NotNull; 9 9 import org.jetbrains.annotations.Nullable; 10 import org.springframework.context.MessageSource;11 import org.springframework.context.support.ClassPathXmlApplicationContext;12 10 13 11 import javax.servlet.ServletOutputStream; … … 132 130 } 133 131 134 /**135 * This method return the text from the files messages**.properties136 *137 * @param code138 * @return139 */140 public static String getMessage( @NotNull final String webInfPath, @NotNull final String code )141 {142 final MessageSource resources = new ClassPathXmlApplicationContext( webInfPath + "/classes/servlet-context.xml" );143 final String message = resources.getMessage( code, null, "Default", null );144 return message;145 }146 147 132 public static final int STATUS_CODE_SERVICE_EXCEPTION = 500; 148 133 public static final String PROPERTIES_FILE = "tapas.properties";
Note: See TracChangeset
for help on using the changeset viewer.