Skip to content

Instantly share code, notes, and snippets.

View csadilek's full-sized avatar

Christian Sadilek csadilek

  • Mozilla
  • Toronto
View GitHub Profile
@Path("customers")
public interface CustomerService {
@GET
@Produces("application/json")
public List<Customer> listAllCustomers();
@POST
@Consumes("application/json")
@Produces("text/plain")
public long createCustomer(Customer customer);
@EntryPoint
public class App {
...
final RemoteCallback<Long> callback = new RemoteCallback<Long>() {
public void callback(Long id) {
Window.alert("Customer created with ID: " + id);
}
};
@PostConstruct
final ErrorCallback errorCallback = new ErrorCallback() {
public boolean error(Message message, Throwable throwable) {
try {
throw throwable;
}
catch (ResponseException e) {
Response response = e.getResponse();
// process unexpected response
response.getStatusCode();
}
package org.jboss.errai.jpa.client.local;
import com.google.gwt.json.client.JSONObject;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.CascadeType;
import javax.persistence.TypedQuery;
import javax.persistence.metamodel.Attribute.PersistentAttributeType;
import javax.persistence.metamodel.Bindable.BindableType;
.E17l0oxA {
background : greenyellow;
margin-top : 3px;
}
.E17l0oxB , .E17l0oxC {
background : greenyellow;
}
div.E17l0oxD {
text-decoration : #000;
}
.E17l0oxA {
background : greenyellow;
margin-top : 3px;
}
.E17l0oxB , .E17l0oxC {
background : greenyellow;
}
div.E17l0oxD {
text-decoration : #000;
}
@Templated
@Page
public class GroceryListView extends Composite {
@PageState
private long activeUserId;
@Sync(query = "groceryListsForUser",
params = { @SyncParam(name = "userId", val = "{activeUserId}") })
private void onDataSyncComplete(SyncResponses<GroceryList> responses) {
@UncaughtException
private void onUncaughtException(Throwable caught) {
try {
throw caught;
}
catch (UserNotAuthenticatedException e) {
// navigate to login dialog
}
catch (Throwable t) {
logger.error("An unexpected error has occurred", t);
@Remote
public interface LongRunningService {
public CallableFuture<String> someLongRunningTask();
}
@Service
public class LongRunningServiceImpl implements LongRunningService {
@Override
public CallableFuture<String> someLongRunningTask() {
final CallableFuture<String> future =
CallableFutureFactory.get().createFuture(String.class);
// Start some asynchronous, potentially slow computation
SomeSlowStringComputation slow = new SomeSlowStringComputation();