Skip to content

Category Archives: JEE6

Understanding Events in JEE6 with examples

JEE 6 implements Event Delagation model and Observer (Publish-Subscribe) pattern out of the box much more elegantly than other api. A Publisher fires events along with a type that needs to be passed. An Observer (can have multiple observers) simply observes for the Event “type” and receives the object sent by the publisher along with [...]

Understanding JSR299, Contexts and Dependency Injection explained

Forget Session, Application, Request, and Coversation Scope. All these scopes, though useful, still have to be managed by hand. ie., – a reference must be created in a session or request (the context) – a utility method must be written to manage this context (& cleanup eventually) – the component needs to have access to [...]

Understanding the uses of JEE6 @Decorator vs @Interceptor with an example

Let’s look at an Interceptor first. Interceptor definition: AuditTime — wraps a simple debug around a method invocation with time stamps. import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; import javax.interceptor.*; @Inherited @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface AuditTime { } Interceptor implementation. import javax.inject.*; import javax.interceptor.*; import org.jboss.logging.*; @AuditTime @Interceptor public class AuditTimeInterceptor implements [...]

Ivy file for a JEE6 / Seam 3-beta / Primefaces project

Most examples online use Maven for build files. I’m sure some of you are still on ant or Ivy. Here’s an ivy file for a starter JEE6 project with Seam-3-beta (at this time of writing), Primefaces, Prettyfaces and other misc jars (testng) that you might need. <?xml version="1.0" encoding="ISO-8859-1"?> <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> <configurations> <conf [...]

Example of RESTful Webservices in JEE6 with Exception mapper to route HTTP status codes

JEE6 provides a specification for Webservices (SOAP AND REST) and JAX-RS is the default Reference implementation. A lot of cookie-cutter code is eliminated for implementing webservices. Unlike Restlet which doesn’t provide much functionality for integrating restful webservices into a web application (exception mapping and custom annotations to process http params, or DI), JEE6 webservices combine [...]