Tapestry5之Application Module
首先说明一下,并不是每一个Tapestry项目的ApplicationModule都是AppModule,而是与这个工程的总的filter决定的。
<filter><filter-name>app</filter-name><filter-class>org.apache.tapestry5.TapestryFilter</filter-class></filter><filter-mapping><filter-name>app</filter-name><url-pattern>/*</url-pattern></filter-mapping>
也就是说与红色部分相关联。
This module is a good place to configure and extend Tapestry, or to place your own service definitions.
这个模块是配置或者扩展Tapestry的一个好地方,我们也可以在这里放置我们自定义的服务。
1 public static void bind(ServiceBinder binder)binder的功能就是通过:a binder.bind(SomeService.class, SomeServiceImpl.class);b binder.bind(SomeService.class);
这样我们就可以Page页面中用@Inject,注入一个SomeService服务。而用到的就是SomeServiceImpl的方法或者是SomeService的方法。
2 Tell Tapestry about our custom translators, validators, and their message files.告诉Tapestry我们自己的转换器,验证器和message文件。
public static void contributeTranslatorAlternatesSource( MappedConfiguration<String, Translator> configuration, ThreadLocale threadLocale)public static void contributeFieldValidatorSource(MappedConfiguration<String, Validator> configuration)public void contributeComponentMessagesSource(OrderedConfiguration<String> configuration)
3 Tell Tapestry about our custom ValueEncoders. We do this by contributing configuration to Tapestry's ValueEncoderSource service.
告诉Tapestry我们自己的编码器(Encoder)。public static void contributeValueEncoderSource(MappedConfiguration<Class, Object> configuration){ configuration.addInstance(Person.class, PersonEncoder.class);}
4 public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration)
这个就是用来修改Tapestry的许多默认的东西的。目前我知道的有:
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en_US,en_GB,fr");
// 修改国际化信息configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false"); // 修改对JQuery的排他configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "$j"); // 修改JQuery的默认符号configuration.add(SymbolConstants.START_PAGE_NAME, "welcome");// 修改默认的首页configuration.add(SymbolConstants.CHARSET, "utf-8");// 修改默认字符集configuration.add(ComponentParameterConstants.GRID_ROWS_PER_PAGE, "15"); //修改grid默认的表示行数 5
Tell Tapestry how to handle JBoss 7's classpath URLs - JBoss uses a "virtual file system".
告诉Tapestry如何去处理JBoss 7的classpath URLs。因为JBoss使用一个虚拟的文件系统。public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration) { configuration.add(ClasspathURLConverter.class, new ClasspathURLConverterJBoss7()); } 6Tell Tapestry how to handle @EJB in page and component classes.告訴Tapestry如何在頁面中處理@EJB
@Primary public static void contributeComponentClassTransformWorker(OrderedConfiguration<ComponentClassTransformWorker2> configuration) {configuration.addInstance("EJB", EJBAnnotationWorker.class, "before:Property"); } 慢慢总结吧,待续。。。
转载于:https://www.cnblogs.com/voctrals/archive/2013/03/27/2985572.html
Tapestry5之Application Module相关推荐
- 【Android 组件化】使用 Gradle 实现组件化 ( 组件 / 集成模式下的 Library Module 开发 )
文章目录 一.组件模式下为组件 Module 指定 Java 源码路径 二.主应用的角色 三.BuildConfig 中生成当前 组件 / 集成 模式字段 四.Library Module 中的代码示 ...
- 如何找到Angular应用的某个directive是属于哪一个Angular module
Suppose I would like to use SAP Spartacus directive cxComponentWrapper in my custom Component,and er ...
- OAException: Application: ICX, Message Name: ICX_SESSION_FAILED.
打完patch之后,重新登录Oracle EBS系统,报错 Exception Details: oracle.apps.fnd.framework.OAException: Could not l ...
- Angular 4+ HttpClient
个人博客迁移至 http://www.sulishibaobei.com 处: 这篇,算是上一篇Angular 4+ Http的后续: Angular 4.3.0-rc.0 版本已经发布?.在这个版 ...
- 解析Erlang日志组件lager的lager_transform模块
为什么80%的码农都做不了架构师?>>> 使用 lager 的时候,在编译应用的时候,需要加入选项 {parse_transform, lager_transform} erl ...
- 如何定时备份数据库并上传七牛云
前言: 这篇文章主要记录自己在备份数据库文件中踩的坑和解决办法. 服务器数据库备份文件之后上传到七牛云 备份数据库文件 在服务器根目录下 创建 /backup/qiniu/.backup.sh #!/ ...
- android组件浮动在activity上_Jetpack Hilt 依赖注入框架上手指南
code小生 一个专注大前端领域的技术平台公众号回复Android加入安卓技术群 作者:LvKang-insist 链接:https://juejin.im/post/5efdff9d6fb9a07e ...
- php e框架是啥,几款主流PHP框架的优缺点评比
PHP语言还是比较常用到的一门计算机高级语言.我们将会在这篇文章中向大家主要介绍关于PHP框架相关优缺点评比,作为一个参考风险给朋友们. 主要参考的PHP框架包括:CodeIgniter.CakePH ...
- 在Zf2中实现Controller按照URL自动注册
为什么80%的码农都做不了架构师?>>> 在Zf2中,一般的情况下,在modules的的某个模块的controller目录下添加一个controller 文件,对应的需要在mo ...
- 从配置文件的角度去了解Yii2
2019独角兽企业重金招聘Python工程师标准>>> 前言 Yii2是一个奇特的框架,其牺牲了现在盛行的解耦设计,用一个高度耦合的结构提供给开发者一个方便的几类抽象,Applica ...
最新文章
- 相关算子、卷积算子、边缘效应
- 解决 VUE前端项目报错:RangeError: Maximum call stack size exceeded
- 手机uc新窗口打开的html标签,在电脑UC浏览器的新窗口页中如何打开书签
- IP地址的分类和层次
- linux qt程序崩溃_Lubuntu 20.04 点评:轻量、简约、文雅 | Linux 中国
- JavaScript学习——JavaScript 条件 语句 switch语句 while语句
- win10修改服务器IP,Win10系统更改本地连接ip地址的方法
- querySelector()与querySelectorAll()
- Java学习笔记(一):Java基础
- FFT FNT 简要整理
- 打卡小程序源码,微信小程序源码下载
- Word论文用的各级标题大小
- 唱响艾泽拉斯_人物篇
- access汇总含义_access的用法总结大全
- 视频播放器三大底层架构
- 华为如何关闭系统更新提示
- 3万亿背后 阿里正在造全球通用计算机
- pdf转换器在线转换详细教程
- 编程不只是兴趣爱好,更是优秀成长路径,您了解吗?
- Linux板子RTC时间设置和修改
热门文章
- 舒尔特表-5*5表格1-25个数字随机生成且不重复
- ios查看帧率的软件_查看iOS屏幕帧数MGFPSStatus
- 深职院计算机专业宿舍,深圳职业技术学院宿舍怎么样 住宿条件好不好
- ubuntu 20.04 pdf viewer 推荐
- php cas 票据认证失败,解决CAS客户端验证ST票据时发生的TicketValidationException问题...
- SMbus和I2C异同, PMBUS
- AIDE MD主题配置
- 软件测试之软件配置项测试
- cadsee plus看图纸 7.2.0.1
- mt管理器显示java_真正免root的MT管理器详细使用教程