210 likes | 536 Views
图解 Java EE 6. 蒋健. GlassFish V3 OnePager 阅读心得分享. Java 企业应用进入 Java EE 时代. 2007.9. Java 企业应用 GlassFish 是 前沿阵地上的排头兵. GlassFish v1/v2 -> Java EE 5 GlassFish v3(V3 Prelude) -> Java EE 6. Java EE6. Java EE5. v3. V3 Prelu d e. v1. v2. UR1. UR2. v2.1. GlassFish 启动. Tomcat. 2009 .6.
E N D
图解 Java EE 6 蒋健 GlassFish V3 OnePager阅读心得分享
2007.9 Java企业应用GlassFish是前沿阵地上的排头兵 • GlassFish v1/v2 -> Java EE 5 • GlassFish v3(V3 Prelude) -> Java EE 6 Java EE6 Java EE5 v3 V3 Prelude v1 v2 UR1 UR2 v2.1 GlassFish启动 Tomcat 2009.6 2005.6 2008.11 2006.5 2008.12
GlassFish V3 One Pager • Overview and Infrastructure • HK2, OSGi, Grizzly, Admin infrastructure, Logging, File Layout, Extensibility, Embedded Server, L10n • Containers and Core Services • Naming and Injection Manager, Resource, Security, Transaction Service ,Scripting, Web, EJB , Metro, Web Service Integration, Jersey Integration, Java EE Service Engine • Management and Monitoring • Command Line, Admin Console, Monitoring, AMX, MBean Annotation Library… • http://wiki.glassfish.java.net/Wiki.jsp?page=V3FunctionalSpecs 开源所开放的不只是源代码。。。
Servlet 3.0 • Ease of development • Pluggability • <web-fragment> • asynchronous support • Server push @WebServlet(name="mytest", urlPatterns={"/myurl"}, initParams={ @InitParam(name="n1", value="v1") }) public class TestServlet extends HttpServlet { .... }
NIO Server • Why NIO Server? • 解决了Java-based Server的性能问题 • Thread, Request, Connection的新玩法 • Grizzly的新进展 • 主外也主内的灰熊 • 前置于Web Container • Atmosphere:Comet Framework • GrizzlyAdapter • ServletAdapter,CometAdapter,OSGiMainAdapter
J2EE without EJB … • Complexity • Entity bean • Less portable • Scalability • No Singleton • 类Java Bean的轻量级开发 • JPA • 所有主流厂家基于标准的一致支持 • 集群,走向成熟 • 3.1支持Singleton
Java EE without EJB 3? • 轻量级的开发 • Annotation,支持DI • 没有部署描述符 • 让EJB容器来遮风避雨 • 可移植性,事务,安全,性能优化 • 管理和监控 • EJB 3.1 • EJB with Restful • War的形式部署 • No interface 将iphone仅仅用作mp3?
JSF • JSF in JEE 6 • Ajax • composite components • JSF in GlassFish • Mojarra - JSF 2.0 RI • JSFTemplate • FaceTester <h:outputScript name="ajax.js" library="javax.faces" target="head"/> … <h:commandButton id="button1" value="Count" onclick="javax.faces.Ajax.ajaxRequest(this, event, {execute: this.id, render: 'out1'}); return false;"/>
Restful - JSR311 • Restful in JEE 6 • 更轻量的Web Service • URI表示可对其执行确定操作的资源 • 和EJB 3.1的结合 • Restful in GlassFish • Jersey是Rest风格的T恤衫 • Restful + JMX用于monitoring @Stateless @Path("ssb") public class HelloWorldEJB { @GET public String hello() { return “Hello World!" ; } } Client client = Client.create(); WebResource webResource = client.resource("http://localhost:8080/helloapp/resources/ssb"); String result = webResource.get(String.class); 通过Jersey在客户端访问URI 将Session Bean发布成RestFul的资源
OSGi • OSGi in JEE6 • 为多数App Server所采用 • 模块化(design time),物理层面上定义依赖 • 动态化(runtime),热插拔,多版本… • OSGi in GlassFish • 不一样的HK2 • 所有模块都以OSGi Bundle的形式提供,update center • 直接部署OSGi bundle asadmin deploy --type osgi simple-service-api.jar telnet localhost 6666 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Felix Remote Shell Console:
JMX • JMX in JEE 6 • 为应用贴上条码 • 轻量级的标准统一的管理接口 • @MBean, @MXBean • JMX in GlassFish • AMX (Appserver Management eXtensions) • GMBAL(GlassFish MBean Annotation Library) • @ManagedObject • JMX+Rest
JEE 6的主题和“秘技” • Annotation • Restful • NIO Server • OSGi Rightsizing = Flexibility, Focus, Simplification
谢谢大家! 家常咖啡 http://blogs.sun.com/jiangjian 21