ro.pippo.core.Application.getMessages()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中ro.pippo.core.Application.getMessages()方法的一些代码示例,展示了Application.getMessages()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getMessages()方法的具体详情如下:
包路径:ro.pippo.core.Application
类名称:Application
方法名:getMessages

Application.getMessages介绍

暂无

代码示例

代码示例来源:origin: pippo-java/pippo

@Override
public Messages getMessages() {
  return application.getMessages();
}

代码示例来源:origin: pippo-java/pippo

@Override
public String getMessage(String key, String language, Object... args) {
  return application.getMessages().get(key, language, args);
}

代码示例来源:origin: pippo-java/pippo

@Override
public String getMessage(String key, Object... args) {
  return application.getMessages().get(key, this, args);
}

代码示例来源:origin: pippo-java/pippo

@Override
public void init(Application application) {
  this.languages = application.getLanguages();
  this.messages = application.getMessages();
  this.router = application.getRouter();

代码示例来源:origin: pippo-java/pippo

/**
 * Performs common initialization for template engines.
 *
 * Implementations must override this method to do their own template engine specific initialization.
 * To use the convenience of this class, implementations must invoke this class's implementation before
 * performing their own initialization.
 *
 * @param application reference to the Pippo {@link Application} that can be used to retrieve settings
 *                     and other settings for the initialization
 */
@Override
public void init(Application application) {
  languages = application.getLanguages();
  messages = application.getMessages();
  router = application.getRouter();
  pippoSettings = application.getPippoSettings();
  fileExtension = pippoSettings.getString(PippoConstants.SETTING_TEMPLATE_EXTENSION, getDefaultFileExtension());
  templatePathPrefix = pippoSettings.getString(PippoConstants.SETTING_TEMPLATE_PATH_PREFIX, TemplateEngine.DEFAULT_PATH_PREFIX);
}

代码示例来源:origin: pippo-java/pippo

log.error("Unexpected error generating '{}' as '{}'", Error.class.getName(), contentType, e);
routeContext.status(HttpConstants.StatusCode.INTERNAL_ERROR);
routeContext.send(application.getMessages().get("pippo.statusCode500", routeContext));

代码示例来源:origin: pippo-java/pippo

/**
 * Prepares an Error instance for the error response.
 *
 * @param statusCode
 * @param routeContext
 * @return an Error
 */
protected Error prepareError(int statusCode, RouteContext routeContext) {
  String messageKey = "pippo.statusCode" + statusCode;
  Error error = new Error();
  error.setStatusCode(statusCode);
  error.setStatusMessage(application.getMessages().get(messageKey, routeContext));
  error.setRequestMethod(routeContext.getRequestMethod());
  error.setRequestUri(routeContext.getRequestUri());
  error.setStacktrace(routeContext.getLocal(STACKTRACE));
  error.setMessage(routeContext.getLocal(MESSAGE));
  return error;
}

代码示例来源:origin: pippo-java/pippo

.set("contextPath", router.getContextPath())
  .set("appPath", router.getApplicationPath()))
.extension(new I18nExtension(application.getMessages()))
.extension(new FormatTimeExtension())
.extension(new PrettyTimeExtension())

代码示例来源:origin: ro.pippo/pippo-velocity

@Override
public void init(Application application) {
  this.languages = application.getLanguages();
  this.messages = application.getMessages();
  this.router = application.getRouter();

代码示例来源:origin: pippo-java/pippo

builder.setProperty(EngineConfigurationKey.DEFAULT_FILE_ENCODING, PippoConstants.UTF8);
builder.registerHelper("ng", new AngularJsHelper());
builder.registerHelper("i18n", new I18nHelper(application.getMessages()));
builder.registerHelper("formatTime", new DateTimeFormatHelper());
builder.registerHelper("prettyTime", new PrettyTimeHelper());

代码示例来源:origin: com.gitblit.fathom/fathom-rest

@Override
protected void setup() {
  String basePath = Strings.nullToEmpty(getSettings().getString(RestServlet.SETTING_URL, null)).trim();
  serve(basePath + "/*").with(RestServlet.class);
  final PippoSettings pippoSettings = getPippoSettings(getSettings());
  final Application application = new Application(pippoSettings);
  // must set context path before starting application
  application.getRouter().setContextPath(getSettings().getContextPath());
  // must set application path before starting application
  String contextPath = application.getRouter().getContextPath();
  String applicationPath = StringUtils.addEnd(contextPath, "/") + StringUtils.removeStart(basePath, "/");
  application.getRouter().setApplicationPath(applicationPath);
  // start the application which sets up all initializers
  application.init();
  bind(Application.class).toInstance(application);
  bind(Router.class).toInstance(application.getRouter());
  bind(Messages.class).toInstance(application.getMessages());
  bind(Languages.class).toInstance(application.getLanguages());
  bind(MimeTypes.class).toInstance(application.getMimeTypes());
  bind(ErrorHandler.class).toInstance(application.getErrorHandler());
  bind(TemplateEngine.class).toInstance(application.getTemplateEngine());
  bind(HttpCacheToolkit.class).toInstance(application.getHttpCacheToolkit());
  bind(ContentTypeEngines.class).toInstance(application.getContentTypeEngines());
  bind(RestService.class);
}

代码示例来源:origin: gitblit/fathom

@Override
protected void setup() {
  String basePath = Strings.nullToEmpty(getSettings().getString(RestServlet.SETTING_URL, null)).trim();
  serve(basePath + "/*").with(RestServlet.class);
  final PippoSettings pippoSettings = getPippoSettings(getSettings());
  final Application application = new Application(pippoSettings);
  // must set context path before starting application
  application.getRouter().setContextPath(getSettings().getContextPath());
  // must set application path before starting application
  String contextPath = application.getRouter().getContextPath();
  String applicationPath = StringUtils.addEnd(contextPath, "/") + StringUtils.removeStart(basePath, "/");
  application.getRouter().setApplicationPath(applicationPath);
  // start the application which sets up all initializers
  application.init();
  bind(Application.class).toInstance(application);
  bind(Router.class).toInstance(application.getRouter());
  bind(Messages.class).toInstance(application.getMessages());
  bind(Languages.class).toInstance(application.getLanguages());
  bind(MimeTypes.class).toInstance(application.getMimeTypes());
  bind(ErrorHandler.class).toInstance(application.getErrorHandler());
  bind(TemplateEngine.class).toInstance(application.getTemplateEngine());
  bind(HttpCacheToolkit.class).toInstance(application.getHttpCacheToolkit());
  bind(ContentTypeEngines.class).toInstance(application.getContentTypeEngines());
  bind(RestService.class);
}

代码示例来源:origin: ro.pippo/pippo-trimou

builder.setProperty(EngineConfigurationKey.DEFAULT_FILE_ENCODING, PippoConstants.UTF8);
builder.registerHelper("ng", new AngularJsHelper());
builder.registerHelper("i18n", new I18nHelper(application.getMessages()));
builder.registerHelper("formatTime", new DateTimeFormatHelper());
builder.registerHelper("prettyTime", new PrettyTimeHelper());

相关文章