Recent Posts
Archives

Posts Tagged ‘JSONP’

PostHeaderIcon [DevoxxBE2013] Part 1: Java EE 7: What’s New in the Java EE Platform

Antonio Goncalves and Arun Gupta, luminaries in Java EE advocacy, deliver a comprehensive exploration of Java EE 7’s advancements, blending simplification with expanded capabilities. Antonio, a senior architect and author of Beginning Java EE 6 Platform with GlassFish 3, collaborates with Arun, Red Hat’s Director of Developer Advocacy and former Java EE pioneer at Sun Microsystems, to unveil WebSocket, JSON processing, and enhanced CDI and JTA features. Their session, rich with demos, highlights how these innovations bolster HTML5 support and streamline enterprise development.

Java EE 7, they assert, refines container services while embracing modern web paradigms. From WebSocket’s real-time communication to CDI’s unified bean management, they showcase practical integrations, ensuring developers can craft scalable, responsive applications.

WebSocket for Real-Time Communication

Antonio introduces WebSocket, a cornerstone for HTML5’s bidirectional connectivity. He demonstrates @ServerEndpoint-annotated classes, crafting a chat application where messages flow instantly, bypassing HTTP’s overhead.

Arun details encoders/decoders, transforming POJOs to wire-ready text or binary frames, streamlining data exchange for real-time apps like live dashboards.

JSON Processing and JAX-RS Enhancements

Arun explores JSON-P (JSR 353), parsing and generating JSON with a fluid API. He demos building JSON objects from POJOs, integrating with JAX-RS’s HTTP client for seamless RESTful interactions.

This synergy, Antonio notes, equips developers to handle data-driven web applications, aligning with HTML5’s data-centric demands.

CDI and Managed Bean Alignment

Antonio unveils CDI’s evolution, unifying managed beans with injectable interceptors. He showcases constructor injection and method-level validation, simplifying dependency management across EJBs and servlets.

Arun highlights JTA’s declarative transactions, enabling @Transactional annotations to streamline database operations, reducing boilerplate.

Simplified JMS and Batch Processing

Arun introduces JMS 2.0’s simplified APIs, demonstrating streamlined message publishing. The new Batch API (JSR 352), Antonio adds, orchestrates chunk-based processing for large datasets, with demos showcasing job definitions.

These enhancements, they conclude, enhance usability, pruning legacy APIs while empowering enterprise scalability.

Resource Definitions and Community Engagement

Antonio details expanded resource definitions, configuring data sources via annotations. Arun encourages JCP involvement, noting Java EE 8’s community-driven roadmap.

Their demos—leveraging GlassFish—illustrate practical adoption, inviting developers to shape future specifications.

Links:

PostHeaderIcon [DevoxxFR2013] Java EE 7 in Detail

Lecturer

David Delabassee is a Principal Product Manager in Oracle’s GlassFish team. Previously at Sun for a decade, he focused on end-to-end Java, related technologies, and tools. Based in Belgium, he contributes to Devoxx Belgium’s steering committee.

Abstract

David Delabassee’s overview details Java EE 7’s innovations, emphasizing developer simplicity and HTML5 support. Covering WebSockets, JSON-P, JAX-RS 2, JMS 2, concurrency, caching, and batch processing, he demonstrates features via GlassFish. The analysis explores alignments with modern needs like cloud and modularity, implications for productivity, and forward compatibility.

Evolution and Key Themes: Simplifying Development and Embracing Modern Web

Delabassee notes Java EE 6’s (2009) popularity, with widespread server adoption. Java EE 7, nearing finalization, builds on this via JCP, comprising 13 updated, 4 new specs.

Themes: ease of development (defaults, pruning), web enhancements (HTML5 via WebSockets), alignment with trends (cloud, multi-tenancy). Pruning removes outdated techs like EJB CMP; new APIs address gaps.

GlassFish 4, the reference implementation, enables early testing. Delabassee demos features, stressing community feedback.

Core API Enhancements: WebSockets, JSON, and REST Improvements

WebSocket (JSR 356): Enables full-duplex, bidirectional communication over single TCP. Annotate endpoints (@ServerEndpoint), handle messages (@OnMessage).

@ServerEndpoint("/echo")
public class EchoEndpoint {
    @OnMessage
    public void echo(String message, Session session) {
        session.getBasicRemote().sendText(message);
    }
}

JSON-P (JSR 353): Parsing/processing API with streaming, object models. Complements JAX-RS for RESTful services.

JAX-RS 2 (JSR 339): Client API, filters/interceptors, async support. Client example:

Client client = ClientBuilder.newClient();
WebTarget target = client.target("http://example.com");
Response response = target.request().get();

These foster efficient, modern web apps.

Messaging and Concurrency: JMS 2 and Utilities for EE

JMS 2 simplifies: annotation-based injection (@JMSConnectionFactory), simplified API for sending/receiving.

@Inject
JMSContext context;

@Resource(lookup="myQueue")
Queue queue;

context.send(queue, "message");

Concurrency Utilities (JSR 236): Managed executors, scheduled tasks in EE context. Propagate context to threads, avoiding direct Thread creation.

Batch Applications (JSR 352): Framework for chunk/step processing, job management. XML-defined jobs with readers, processors, writers.

Additional Features and Future Outlook: Caching, CDI, and Java EE 8

Though JCache (JSR 107) deferred, it enables standardized distributed caching, usable on EE 7.

CDI 1.1 enhances: @Vetoed for exclusions, alternatives activation.

Java EE 8 plans: modularity, cloud (PaaS/SaaS), further HTML5. Community shapes via surveys.

Delabassee urges Adopt-a-JSR participation for influence.

Implications for Enterprise Development: Productivity and Adaptability

Java EE 7 boosts productivity via simplifications, aligns with web/cloud via new APIs. Demos show practical integration, like WebSocket chats or batch jobs.

Challenges: Learning curve for new features; benefits outweigh via robust, scalable apps.

Forward, EE 7 paves for EE 8’s evolutions, ensuring Java’s enterprise relevance.

Links: