Skip to content

Instantly share code, notes, and snippets.

Queue RPC Requests in GWT

The Problem

One of the handier tools in the GWT toolbox is a built in AJAX framework referred to as RPC or Remote Procedure Calls. Here’s the thing: Internet Explorer version 7 and prior is not awesome. IE pre-8 restricts the number of simultaneous XmlHttp requests to two for a given host. In most cases, this restriction doesn’t pose a real problem. For a rich client application (like the kind GWT is a good choice for) that may be leaving one of those two allowable connections open for a long poll while

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>artifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.xtend</groupId>
<artifactId>gwt-deps</artifactId>
<version>AUTO</version>
<properties>
<xtend.version>2.4.1-SNAPSHOT</xtend.version>
</properties>
@rzymek
rzymek / DataConstructor.xtend
Last active December 16, 2015 15:49
Creates fields for all the annotated constructor parameters
package xtend.active.annotations
import java.util.List
import org.eclipse.xtend.lib.macro.Active
import org.eclipse.xtend.lib.macro.TransformationContext
import org.eclipse.xtend.lib.macro.TransformationParticipant
import org.eclipse.xtend.lib.macro.declaration.MutableConstructorDeclaration
import org.eclipse.xtend.lib.macro.declaration.Visibility
@Active(typeof(DataContructorProcessor))
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>YOUR_GROUP_ID</groupId>
<artifactId>YOUR_ARTIFACT_ID</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@rzymek
rzymek / octodex.sh
Created May 16, 2013 08:16
Get all octodex images
wget -q http://octodex.github.com/ -O - |grep -o 'http://octodex.github.com/images/[^"]*' |xargs wget
@rzymek
rzymek / HotRedeployer.java
Created August 20, 2013 13:01
JBoss 7 redeploy on refresh
package jboss7;
import java.io.File;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
@rzymek
rzymek / ReDeployJboss7WAR.java
Created August 22, 2013 15:10
native JBoss 7 client to redeploy a war.
/*
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-controller-client</artifactId>
<version>7.2.0.Final</version>
</dependency>
*/
public class ReDep {
public String reboot() throws Exception {
package config
import com.googlecode.flyway.core.Flyway
import java.util.logging.Logger
import javax.annotation.PostConstruct
import javax.annotation.Resource
import javax.ejb.EJBException
import javax.ejb.Singleton
import javax.ejb.Startup
import javax.ejb.TransactionManagement

Post ideas

  • WildFly redeplyment: touch .dodeploy, jboss-cli, curl, native client, admin console
  • redeploy-proxy
  • java bombs: Disgruntled-Bomb-Java-Edition,
    EnterpriseJavaRootkits-PAPER
  • perfect web framework: play scala, play java, ee6 (wildfly,mvn,xtend), meteor
  • implementing booking using SQL and MongoDB
  • Staticly typed Web (GWT, Dart, TypeScript)