The browser as a platform.
What if you could use Java, CDI, and JPA in your web browser? What if you could use Java without losing any of the flexibility of HTML5, JavaScript and CSS? The answer is, you can. And that framework is Errai!
How productive can you be with Errai? We think this video speaks for itself:
Announcement:Errai 2.3.1.Final Released!
Check out the latest and greatest in rich web development!
See the release notes for details.
For a look at our high-level goals, check out the Errai Roadmap.
Get Rolling
Errai makes building your rich web application in GWT easier. We cut the boilerplate and promote annotation driven development. With Errai, everything is a bean in the client. Just annotate!
@EntryPoint
public void App {
@PostConstruct
public void helloWorld() {
Window.alert("Hello, World!");
}
}
Get Talking
Talking to the server is much easier, too! Leveraging ErraiBus, you can transparently and easily mix event-based and RPC-based functionality in your app as neccessary. When leveraging the bus, everything in your app is push, everything is asynchronous!
@EntryPoint
public void App {
@Inject
Caller<MyRpcService> rpcCaller;
// ... //
@UiHandler("button")
public void clickHandler(ClickEvent evt) {
rpcCaller.call(new RemoteCallback<String>() {
public void callback(String response) {
Window.alert("The server said: " + response);
}
}).sayHello();
}
}Get Decoupled with CDI
With Errai CDI, the power of the CDI programming model comes to the browser. And it's more than injections, producers and qualifiers. You can hook directly into the server-side eventing system from the client with client observers, which directly use CDI APIs from the browser!
// this is really client code!
@ApplicationScoped
public void App {
@Inject Event<ClientEvent> clientEvent;
public void observeServerEvent(@Observes ServerEvent evt) {
Window.alert("Received an event from server: " + evt.getMessage());
}
// .. //
@UiHandler("button")
public void handleClick(ClickEvent evt) {
clientEvent.fire(new ClientEvent("button was clicked!"));
}
}
Get RESTful
Talk RESTful-ly to the server using Errai's JAX-RS module. Lay down a JAX-RS service:
@Path("customers")
public interface CustomerService {
@POST
@Consumes("application/json")
@Produces("text/plain")
public long createCustomer(Customer customer);
} And call in from a client side bean!
@ApplicationScoped
public class App {
@Inject
private Caller<CustomerService> customerService;
// ... //
@UiHandler("button")
public void handleClick(ClickEvent evt) {
customerService.call(new RemoteCallback<Long>() {
public void callback(Long response) {
Window.alert(response);
}
}).createCustomer(customer);
}
// ..//
}It really is that easy. With Errai, you cut the boilerplate.
Get Started Right Now
Create a started project with our Maven archetype.
If you want to get started with a CDI based project, with all the bells and whistles, then copy and paste this code into your shell. (Note: you need maven installed)
mvn archetype:generate -DarchetypeGroupId=org.jboss.errai.archetypes -DarchetypeArtifactId=cdi-quickstart -DarchetypeVersion=2.3.1.Final
If you need further instructions, check out this link.
Our most up-to-date documentation is here: https://docs.jboss.org/author/display/ERRAI/Home
Errai Developer Blog
- Upcoming JBoss and Red Hat events!
- May 9, 2013 2:39 PM
- As you know, Errai is sponsored by JBoss and Red Hat. Errai and other great Red Hat open source tech…
- Errai 2.3.0.CR1 released!
- Mar 26, 2013 5:33 PM
- We've just released Errai 2.3.0.CR1. This is a maintenance release fixing all reported bugs in 2.2.0…
- Maven Cordova Plugin
- Mar 20, 2013 11:33 AM
- As you may already know, we are also focusing on making mobile applications with Errai. We have some…