+ */
+@EntryPoint
+public class HelloWorldApp {
+
+ /**
+ * Errai's JAX-RS module generates a stub class that makes AJAX calls back to
+ * the server for each resource method on the {@link HelloWorldResource}
+ * interface. The paths and HTTP methods for the AJAX calls are determined
+ * automatically based on the JAX-RS annotations ({@code @Path}, {@code @GET},
+ * {@code @POST}, and so on) on the resource.
+ *
+ * You can create additional JAX-RS proxies by following the same pattern
+ * ({@code @Inject Caller}) with your own JAX-RS resource
+ * classes.
+ */
+ @Inject
+ private Caller helloWorldCaller;
+
+ /**
+ * This method creates an instance of the UiBinder UI {@link HelloWorldClient}
+ * and attaches it to the RootPanel, the top-level DOM node that is an
+ * ancestor to all GWT widgets on the page (the {@code } element of the
+ * HTML document).
+ */
+ @PostConstruct
+ public void init() {
+ RootPanel.get().add(new HelloWorldClient(helloWorldCaller).getElement());
+ }
+
+}
diff --git a/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/local/HelloWorldClient.java b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/local/HelloWorldClient.java
new file mode 100644
index 0000000000..69632a7b93
--- /dev/null
+++ b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/local/HelloWorldClient.java
@@ -0,0 +1,96 @@
+package org.jboss.as.quickstarts.erraihelloworld.client.local;
+
+import org.jboss.as.quickstarts.erraihelloworld.client.shared.HelloWorldResource;
+import org.jboss.errai.bus.client.api.ErrorCallback;
+import org.jboss.errai.bus.client.api.Message;
+import org.jboss.errai.bus.client.api.RemoteCallback;
+import org.jboss.errai.ioc.client.api.Caller;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.InputElement;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Panel;
+
+/**
+ * Companion class to the UI declared in {@linkplain HelloWorldClient.ui.xml}.
+ * Handles events and updates the DOM in response.
+ *
+ * @author Jonathan Fuerth
+ * @author Christian Sadilek
+ */
+public class HelloWorldClient {
+
+ // The following two lines are boilerplate required by the GWT UiBinder system
+
+ interface MyUiBinder extends UiBinder {}
+ private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
+
+
+ // The following fields annotated with @UiField are injected by UiBinder
+ // when the constructor calls uiBinder.createAndBindUi(this).
+
+ @UiField Panel root;
+ @UiField Label result;
+ @UiField InputElement name;
+ @UiField Button sayHelloButton;
+
+ /**
+ * Typesafe stub for calling methods on the JAX-RS resource class {@link HelloWorldResource}.
+ */
+ private final Caller helloWorldCaller;
+
+ HelloWorldClient(Caller helloWorldCaller) {
+ this.helloWorldCaller = helloWorldCaller;
+
+ // populates all the @UiField members with the corresponding DOM nodes
+ // in HelloWorldClient.ui.xml
+ uiBinder.createAndBindUi(this);
+
+ // Programmatically setting the button name attribute of the sayHelloButton.
+ // We do this so that we can refer to the button by name from the handwritten
+ // inline JavaScript in the form onSubmit handler in HelloWorldClient.ui.xml.
+ // This is not a typical approach in GWT, but it illustrates one way to achieve
+ // easy interoperability between GWT widgets and traditional HTML + JavaScript.
+ DOM.setElementAttribute(sayHelloButton.getElement(), "name", "sayHelloButton");
+ }
+
+ /**
+ * Handles a click of the button by sending an AJAX request to the
+ * HelloWorldResourceImpl and then updating the {@code result} label in response.
+ *
+ * @param e Details of the click event. Ignored by this handler.
+ */
+ @UiHandler("sayHelloButton")
+ public void onButtonClick(ClickEvent e) {
+ helloWorldCaller.call(new RemoteCallback() {
+
+ @Override
+ public void callback(String name) {
+ result.setText(name);
+ }
+ }, errorCallback).getHelloWorldJSON(name.getValue());
+ }
+
+ /**
+ * Returns the root of the DOM subtree under control of this UiBinder widget.
+ */
+ public Panel getElement() {
+ return root;
+ }
+
+ private ErrorCallback errorCallback = new ErrorCallback() {
+
+ @Override
+ public boolean error(Message message, Throwable throwable) {
+ result.setText("Sorry, can't say hello now. " + throwable.getMessage());
+ return false;
+ }
+ };
+
+}
diff --git a/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/local/HelloWorldClient.ui.xml b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/local/HelloWorldClient.ui.xml
new file mode 100644
index 0000000000..b58c447042
--- /dev/null
+++ b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/local/HelloWorldClient.ui.xml
@@ -0,0 +1,15 @@
+
+
+
+ GWT Hello World
+
+
+
+
diff --git a/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/shared/HelloWorldResource.java b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/shared/HelloWorldResource.java
new file mode 100644
index 0000000000..81d2ebf225
--- /dev/null
+++ b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/client/shared/HelloWorldResource.java
@@ -0,0 +1,28 @@
+package org.jboss.as.quickstarts.erraihelloworld.client.shared;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+
+/**
+ * A simple REST service which is able to say hello to someone using
+ * HelloService. Please take a look at the web.xml where JAX-RS is enabled and
+ * notice the @PathParam which expects the URL to contain {@code /json/David} or
+ * {@code /xml/Mary}.
+ */
+@Path("/")
+public interface HelloWorldResource {
+
+ @GET
+ @Path("/json/{name}")
+ @Produces("application/json")
+ public String getHelloWorldJSON(@PathParam("name") String name);
+
+ @GET
+ @Path("/xml/{name}")
+ @Produces("application/xml")
+ public String getHelloWorldXML(@PathParam("name") String name);
+
+}
diff --git a/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/server/HelloService.java b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/server/HelloService.java
new file mode 100644
index 0000000000..3ed9fb4ac0
--- /dev/null
+++ b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/server/HelloService.java
@@ -0,0 +1,14 @@
+package org.jboss.as.quickstarts.erraihelloworld.server;
+
+/**
+ * A simple CDI service that says hello to someone.
+ *
+ * @author Pete Muir
+ */
+public class HelloService {
+
+ String createHelloMessage(String name) {
+ return "Hello " + name + "!";
+ }
+
+}
diff --git a/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/server/HelloWorldResourceImpl.java b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/server/HelloWorldResourceImpl.java
new file mode 100644
index 0000000000..cede937712
--- /dev/null
+++ b/helloworld-errai/src/main/java/org/jboss/as/quickstarts/erraihelloworld/server/HelloWorldResourceImpl.java
@@ -0,0 +1,35 @@
+package org.jboss.as.quickstarts.erraihelloworld.server;
+
+import javax.inject.Inject;
+import javax.ws.rs.PathParam;
+
+import org.jboss.as.quickstarts.erraihelloworld.client.shared.HelloWorldResource;
+
+
+/**
+ * A simple REST service which is able to say hello to someone using
+ * HelloService. Please take a look at the web.xml where JAX-RS is enabled and
+ * notice the @PathParam which expects the URL to contain {@code /json/David} or
+ * {@code /xml/Mary}.
+ *
+ * @author bsutter@redhat.com
+ */
+public class HelloWorldResourceImpl implements HelloWorldResource {
+
+ @Inject
+ HelloService helloService;
+
+ @Override
+ public String getHelloWorldJSON(@PathParam("name") String name) {
+ System.out.println("name: " + name);
+ return helloService.createHelloMessage(name);
+ }
+
+ @Override
+ public String getHelloWorldXML(@PathParam("name") String name) {
+ System.out.println("name: " + name);
+ return "" + helloService.createHelloMessage(name)
+ + "";
+ }
+
+}
diff --git a/helloworld-errai/src/main/resources/ErraiApp.properties b/helloworld-errai/src/main/resources/ErraiApp.properties
new file mode 100644
index 0000000000..0ca66b3218
--- /dev/null
+++ b/helloworld-errai/src/main/resources/ErraiApp.properties
@@ -0,0 +1,17 @@
+#
+# Copyright 2011 JBoss, a divison Red Hat, Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# required marker interface
diff --git a/helloworld-errai/src/main/resources/ErraiService.properties b/helloworld-errai/src/main/resources/ErraiService.properties
new file mode 100644
index 0000000000..08bd072f11
--- /dev/null
+++ b/helloworld-errai/src/main/resources/ErraiService.properties
@@ -0,0 +1,21 @@
+#
+# Copyright 2011 JBoss, a divison Red Hat, Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+errai.require_authentication_for_all=false
+errai.application_context=/App/
+errai.login_motd=UNAUTHORIZED ACCESS IS PROHIBITED!
+
diff --git a/helloworld-errai/src/main/resources/log4j.properties b/helloworld-errai/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..59c4526874
--- /dev/null
+++ b/helloworld-errai/src/main/resources/log4j.properties
@@ -0,0 +1,23 @@
+#
+# Copyright 2010 JBoss, a divison Red Hat, Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+log4j.rootLogger=INFO, A1
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.mainlogger.layout.ConversionPattern=%d [%t] %-5p %c{1} - %m%n
+
+log4j.logger.org.reflections=INFO
+log4j.logger.org.jboss.resteasy=INFO
diff --git a/helloworld-errai/src/main/webapp/HelloWorldApp.html b/helloworld-errai/src/main/webapp/HelloWorldApp.html
new file mode 100644
index 0000000000..a3921d3c64
--- /dev/null
+++ b/helloworld-errai/src/main/webapp/HelloWorldApp.html
@@ -0,0 +1,11 @@
+
+
+
+ GWT Hello World
+
+
+
+
+
+
+
diff --git a/helloworld-errai/src/main/webapp/WEB-INF/beans.xml b/helloworld-errai/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000000..4bb1bb81c0
--- /dev/null
+++ b/helloworld-errai/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/helloworld-errai/src/main/webapp/WEB-INF/web.xml b/helloworld-errai/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..3fe5ca126c
--- /dev/null
+++ b/helloworld-errai/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+ javax.ws.rs.core.Application
+ /hello/*
+
+
+
+ HelloWorldApp.html
+
+
+
+ ErraiServlet
+ org.jboss.errai.bus.server.servlet.DefaultBlockingServlet
+ 1
+
+
+
+ ErraiServlet
+ *.erraiBus
+
+
+
+ HelloWorldApp.html
+
+