Skip to content

Instantly share code, notes, and snippets.

View raphaelbauer's full-sized avatar

Raphael A. Bauer raphaelbauer

View GitHub Profile
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>../YOUR_DEPLOYMENT_DIRECTORY</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
<followSymlinks>false</followSymlinks>
@raphaelbauer
raphaelbauer / gist:1669528
Created January 24, 2012 10:34
xs / xsi linker GWT
<add-linker name="xs" />
or
<add-linker name="xsi" />
@raphaelbauer
raphaelbauer / gist:2107757
Created March 19, 2012 11:07
Testexample - possible Play 2 bug
package testexamples;
import static org.fest.assertions.Assertions.assertThat;
import static play.test.Helpers.HTMLUNIT;
import static play.test.Helpers.running;
import static play.test.Helpers.testServer;
import org.junit.Test;
import play.libs.F.Callback;
[info] [SUCCESSFUL ] org.scalatest#scalatest_2.9.1;1.6.1!scalatest_2.9.1.jar (250ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/org/codehaus/jackson/jackson-core-asl/1.9.5/jackson-core-asl-1.9.5.jar ...
[info] [SUCCESSFUL ] org.codehaus.jackson#jackson-core-asl;1.9.5!jackson-core-asl.jar (44ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/com/thoughtworks/paranamer/paranamer/2.3/paranamer-2.3.jar ...
[info] [SUCCESSFUL ] com.thoughtworks.paranamer#paranamer;2.3!paranamer.jar (37ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/com/google/guava/guava/r09/guava-r09.jar ...
[info] [SUCCESSFUL ] com.google.guava#guava;r09!guava.jar (120ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/play/play-test_2.9.1/2.0/play-test_2.9.1-2.0.jar ...
[info] [SUCCESSFUL ] play#play-test_2.9.1;2.0!play-test_2.9.1.jar (62ms)
[info] Done updating.
[info] [SUCCESSFUL ] org.scalatest#scalatest_2.9.1;1.6.1!scalatest_2.9.1.jar (250ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/org/codehaus/jackson/jackson-core-asl/1.9.5/jackson-core-asl-1.9.5.jar ...
[info] [SUCCESSFUL ] org.codehaus.jackson#jackson-core-asl;1.9.5!jackson-core-asl.jar (44ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/com/thoughtworks/paranamer/paranamer/2.3/paranamer-2.3.jar ...
[info] [SUCCESSFUL ] com.thoughtworks.paranamer#paranamer;2.3!paranamer.jar (37ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/com/google/guava/guava/r09/guava-r09.jar ...
[info] [SUCCESSFUL ] com.google.guava#guava;r09!guava.jar (120ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/play/play-test_2.9.1/2.0/play-test_2.9.1-2.0.jar ...
[info] [SUCCESSFUL ] play#play-test_2.9.1;2.0!play-test_2.9.1.jar (62ms)
[info] Done updating.
@raphaelbauer
raphaelbauer / ParameterizedParameterTokenFormatter.java
Created March 30, 2012 15:11
ParameterizedParameterTokenFormatter
package com.bricktop.app.client.common.places;
import com.google.gwt.http.client.URL;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.proxy.ParameterTokenFormatter;
import com.gwtplatform.mvp.client.proxy.PlaceRequest;
import com.gwtplatform.mvp.client.proxy.TokenFormatException;
import com.gwtplatform.mvp.client.proxy.TokenFormatter;
import java.util.ArrayList;
@raphaelbauer
raphaelbauer / gist:3121858
Created July 16, 2012 09:47
simple mocked ninja controller test
@Test
public void restRedirectToIndex() {
Result result = applicationController.redirectToIndex(context);
//assert that status is temporary redirect:
assertEquals(Result.SC_307_TEMPORARY_REDIRECT, result.getStatusCode());
//assert that Location header was set correctly
Map<String, String> headers = result.getHeaders();
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.drive.DriveScopes;
import com.google.code.samples.oauth2.OAuth2Authenticator;
import com.sun.mail.imap.IMAPStore;
import java.io.File;
@raphaelbauer
raphaelbauer / gist:6329621
Created August 24, 2013 18:22
Ninja Framwork - Just a helper class that bypasses the built-in Json serializer and helps rendering the exact stuff you put as "string". Bypasses all built-in json serializers.
package conf;
import java.io.OutputStream;
import ninja.Context;
import ninja.Renderable;
import ninja.Result;
import ninja.utils.ResponseStreams;
public class ResultJsonCustom {
@raphaelbauer
raphaelbauer / gist:8029616
Last active December 31, 2015 18:49
UnitOfWork Filter for Ninja - allows lightweight JPA usage ins resource-local mode. Annotate your classes / methods with @FilterWith(DatabaseAccess.class) to use JPA without explicit transactions.
public class DatabaseAccess implements Filter {
@Inject
private UnitOfWork unitOfWork;
@Override
public Result filter(FilterChain filterChain, Context context) {
Result result;