Tag Archives: javaee7

Trending Meetup groups with Redis and Java EE

This is an application which displays the currently trending Meetup groups based on their (live) RSVPs feed. It’s built using Java EE 7 (uses WebSocket client & server APIs, Singleton EJB timers and CDI events to wire things up) and … Continue reading

Posted in Java, Java EE | Tagged , , , , , , , | Leave a comment

Quick tip: managing Stateful EJBs in WebSocket endpoints

@Stateful EJBs can be injected in WebSocket endpoints (supported by the WebSocket specification). There is an one-to-one association between the WebSocket client & endpoint (which is by default) as well as the injected Stateful EJB instance, which makes it an good candidate for storing … Continue reading

Posted in Java, Java EE | Tagged , , , , , , | Leave a comment

WebSocket endpoint as Singleton EJB

By default … … a WebSocket implementation creates a new (server) endpoint instance per client. In case you need a single instance, you can implement this using a custom ServerEndpointConfig.Configurator (by overriding the getEndpointInstance method) The catch: you might have to sacrifice some … Continue reading

Posted in Java, Java EE | Tagged , , , , | 3 Comments

Using Asynchronous timeouts in the Java WebSocket API

Sending messages in an asynchronous manner avoid blocking the sending thread. This is a great where your solution needs to scale in order to support a large number of clients. But there is a limit on how long can we … Continue reading

Posted in Java, Java EE | Tagged , , , , , | Leave a comment

Dynamic provider registration in JAX-RS

The DynamicFeature class in JAX-RS (2.0) allows you to register providers Dynamically i.e. without any pre-defined binding strategy (e.g. annotations) Based on criteria i.e. to help decide which provider to bind to which JAX-RS resource(s) The JAX-RS implementation detects and executes … Continue reading

Posted in Java, Java EE | Tagged , , , , | Leave a comment

WebSocket and CDI integration.. again..

In one of my older blog posts, I had written about what does not work as far as WebSocket and CDI integration within the Java EE Platform 😉 This one talks about what’s possible with CDI in terms of Dependency Injection Interceptors … Continue reading

Posted in Java, Java EE | Tagged , , , , , , , | 3 Comments

Configuring WebSocket server endpoints

WebSocket Server endpoint configuration Before we dive into the details, here is a quick snapshot of the related interfaces Class/Interface Description ServerEndpointConfig A derivative of EndpointConfig interface which is specific for configuration related to server side WebSocket endpoints ServerEndpointConfig.Configurator An … Continue reading

Posted in Java, Java EE | Tagged , , , , | Leave a comment

Java Websocket containers: the possibilities

The Java Websocket API (JSR 356) specification supports different containers Good old Java EE 7 app servers – since Websocket API is integrated directly into the Java EE 7 Platform Servlet 3.1 containers Standalone containers – for runtimes which are … Continue reading

Posted in Java EE | Tagged , , , , , | Leave a comment

Hybrid queries with JPA 2.1

Before JPA 2.1 There were two types of queries Named (static): these are declared using the @NamedQuery or @NamedQueries annotations. Dynamic: as the name suggests, this type of query is specified by the application logic at runtime JPQL, Native SQL as … Continue reading

Posted in Java EE | Tagged , , , , , , | Leave a comment

Custom Security Context in JAX-RS

And the JAX-RS juggernaut continues …. This blog briefly talks about how to override the default security related information associated with a JAX-RS request i.e. how to mess with the SecurityContext Wait.. Security Context ? Think of it as a JAX-RS … Continue reading

Posted in Java EE | Tagged , , , | Leave a comment