本文整理了Java中org.springframework.context.ApplicationContext.getMessage()
方法的一些代码示例,展示了ApplicationContext.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationContext.getMessage()
方法的具体详情如下:
包路径:org.springframework.context.ApplicationContext
类名称:ApplicationContext
方法名:getMessage
暂无
代码示例来源:origin: spring-projects/spring-framework
@Override
public void setApplicationContext(ApplicationContext ctx) throws ApplicationContextException {
// check reinitialization
if (this.ac != null) {
throw new IllegalStateException("Already initialized");
}
// check message source availability
if (ctx != null) {
try {
ctx.getMessage("code1", null, Locale.getDefault());
}
catch (NoSuchMessageException ex) {
// expected
}
}
this.ac = ctx;
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void setApplicationContext(ApplicationContext ctx) throws ApplicationContextException {
// check reinitialization
if (this.ac != null) {
throw new IllegalStateException("Already initialized");
}
// check message source availability
if (ctx != null) {
try {
ctx.getMessage("code1", null, Locale.getDefault());
}
catch (NoSuchMessageException ex) {
// expected
}
}
this.ac = ctx;
}
代码示例来源:origin: sanluan/PublicCMS
/**
* @param applicationContext
* @param locale
* 语言
*
* @param code
* 国际化代码
* @param args
* 替换参数
* @return international message
*/
public static String getMessage(ApplicationContext applicationContext, Locale locale, String code, Object... args) {
String result;
try {
result = applicationContext.getMessage(code, args, locale);
} catch (NoSuchMessageException e) {
result = code;
}
return result;
}
}
代码示例来源:origin: sanluan/PublicCMS
/**
* @param applicationContext
* @param locale
* 语言
*
* @param code
* 国际化代码
* @param args
* 替换参数
* @return international message
*/
public static String getMessage(ApplicationContext applicationContext, Locale locale, String code, Object... args) {
String result;
try {
result = applicationContext.getMessage(code, args, locale);
} catch (NoSuchMessageException e) {
result = code;
}
return result;
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-common
/**
* @param arg0
* @param arg1
* @return
* @throws NoSuchMessageException
* @see org.springframework.context.MessageSource#getMessage(org.springframework.context.MessageSourceResolvable, java.util.Locale)
*/
public String getMessage(MessageSourceResolvable arg0, Locale arg1) throws NoSuchMessageException {
return target.getMessage(arg0, arg1);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-common
/**
* @param arg0
* @param arg1
* @param arg2
* @param arg3
* @return
* @see org.springframework.context.MessageSource#getMessage(java.lang.String, java.lang.Object[], java.lang.String, java.util.Locale)
*/
public String getMessage(String arg0, Object[] arg1, String arg2, Locale arg3) {
return target.getMessage(arg0, arg1, arg2, arg3);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-common
/**
* @param arg0
* @param arg1
* @param arg2
* @return
* @throws NoSuchMessageException
* @see org.springframework.context.MessageSource#getMessage(java.lang.String, java.lang.Object[], java.util.Locale)
*/
public String getMessage(String arg0, Object[] arg1, Locale arg2) throws NoSuchMessageException {
return target.getMessage(arg0, arg1, arg2);
}
代码示例来源:origin: com.consol.citrus/citrus-ws
public String getMessage(MessageSourceResolvable resolvable, Locale locale)
throws NoSuchMessageException {
return applicationContext.getMessage(resolvable, locale);
}
public BeanFactory getParentBeanFactory() {
代码示例来源:origin: net.sf.taverna.t2.infrastructure/platform-spring
/**
* Delegates to internal ApplicationContext supplied by constructor
*/
public final String getMessage(MessageSourceResolvable arg0, Locale arg1)
throws NoSuchMessageException {
return context.getMessage(arg0, arg1);
}
代码示例来源:origin: net.sf.taverna.t2.infrastructure/platform-spring
/**
* Delegates to internal ApplicationContext supplied by constructor
*/
public final String getMessage(String arg0, Object[] arg1, String arg2,
Locale arg3) {
return context.getMessage(arg0, arg1, arg2, arg3);
}
代码示例来源:origin: com.consol.citrus/citrus-ws
public String getMessage(String code, Object[] args, Locale locale)
throws NoSuchMessageException {
return applicationContext.getMessage(code, args, locale);
}
public String getMessage(MessageSourceResolvable resolvable, Locale locale)
代码示例来源:origin: net.javacrumbs/smock-http
public String getMessage(String code, Object[] args, String defaultMessage,
Locale locale) {
return wrappedApplicationContext.getMessage(code, args, defaultMessage,
locale);
}
代码示例来源:origin: com.consol.citrus/citrus-ws
public String getMessage(String code, Object[] args, String defaultMessage,
Locale locale) {
return applicationContext.getMessage(code, args, defaultMessage, locale);
}
public String getMessage(String code, Object[] args, Locale locale)
代码示例来源:origin: net.sf.taverna.t2.infrastructure/platform-spring
/**
* Delegates to internal ApplicationContext supplied by constructor
*/
public final String getMessage(String arg0, Object[] arg1, Locale arg2)
throws NoSuchMessageException {
return context.getMessage(arg0, arg1, arg2);
}
代码示例来源:origin: org.apereo.cas/cas-server-support-rest
private String getTranslatedMessageForExceptionClass(final String className,
final HttpServletRequest request,
final ApplicationContext applicationContext) {
try {
val msgKey = MessageBundleProperties.DEFAULT_BUNDLE_PREFIX_AUTHN_FAILURE + className;
return applicationContext.getMessage(msgKey, null, request.getLocale());
} catch (final Exception e) {
LOGGER.trace(e.getMessage(), e);
return StringUtils.EMPTY;
}
}
}
代码示例来源:origin: apache/archiva
@Override
public String getMessage( String s, Object[] objects, Locale locale )
throws NoSuchMessageException
{
return applicationContext.getMessage( s, objects, locale );
}
代码示例来源:origin: apache/archiva
@Override
public String getMessage( MessageSourceResolvable messageSourceResolvable, Locale locale )
throws NoSuchMessageException
{
return applicationContext.getMessage( messageSourceResolvable, locale );
}
代码示例来源:origin: apache/archiva
@Override
public String getMessage( String s, Object[] objects, String s2, Locale locale )
{
return applicationContext.getMessage( s, objects, s2, locale );
}
代码示例来源:origin: peholmst/vaadin4spring
private String getMessage(String code, Locale locale, Object... arguments) {
Locale actualLocale = locale == null ? getLocale() : locale;
try {
return applicationContext.getMessage(code, arguments, actualLocale);
} catch (NoSuchMessageException ex) {
if (isRevertToDefaultBundle()) {
return applicationContext.getMessage(code, arguments, null);
} else {
throw ex;
}
}
}
代码示例来源:origin: spring-projects/spring-webflow
public void testResourceBackedFlowBuilderWithMessages() {
ClassPathResource resource = new ClassPathResource("resources/flow.xml", FlowModelFlowBuilderTests.class);
Flow flow = getFlow(resource);
assertNotNull(flow.getApplicationContext());
assertEquals("bar", flow.getApplicationContext().getMessage("foo", null, null));
}
内容来源于网络,如有侵权,请联系作者删除!