Skip to content

Instantly share code, notes, and snippets.

@beckje01
beckje01 / gist:30c886df1189f3d2dea7
Created July 14, 2014 14:19
HttpClient Proxy Scratch
get { HttpClient httpClient ->
def result = httpClient.request("http://beckje01.com", { RequestSpec requestSpec ->
requestSpec.body.type("text/plain").stream { it << request.body.text }
requestSpec.method(request.method.toString())
request.headers.getNames().each {
requestSpec.headers.set(it, request.headers.get(it))
}
})
result.onError({
@beckje01
beckje01 / contextExample.groovy
Created July 28, 2014 08:49
Ratpack Context Examples
@Grab('io.ratpack:ratpack-groovy:0.9.6')
import ratpack.registry.RegistrySpec
import static ratpack.groovy.Groovy.*
import static ratpack.registry.Registries.registry
ratpack {
handlers {
handler {
import org.apache.log4j.MDC
class LoggingFilters {
public static final String CORRELATION_HEADER = "X-CorrelationId" //Our Standard
def filters = {
correlationId(controller: '*', action: '*') { //For all requests
before = {
String correlationId = request.getHeader(CORRELATION_HEADER)
### Keybase proof
I hereby claim:
* I am beckje01 on github.
* I am beckje01 (https://keybase.io/beckje01) on keybase.
* I have a public key whose fingerprint is 857D 6372 9EA4 7492 4FB7 D95A C3C2 391B B016 F80A
To claim this, I am signing this object:
@beckje01
beckje01 / BearerAuthHandler.groovy
Created May 13, 2015 15:03
OAuth2 Vertx 3 Bearer Token start
import io.vertx.core.http.HttpHeaders
import io.vertx.core.http.HttpServerRequest
import io.vertx.core.json.JsonObject
import io.vertx.ext.apex.RoutingContext
import io.vertx.ext.apex.handler.impl.AuthHandlerImpl
import io.vertx.ext.auth.AuthProvider;
class BearerAuthHandler extends AuthHandlerImpl {
@beckje01
beckje01 / feed.xml
Last active August 20, 2018 12:27
Cassandra atom feed
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.4.3">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2018-08-20T07:13:23-05:00</updated><id>http://localhost:4000/</id><title type="html">Apache Cassandra Website</title><subtitle>The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance. Linear scalability and proven fault-tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data. Cassandra's support for replicating across multiple datacenters is best-in-class, providing lower latency for your users and the peace of mind of knowing that you can survive regional outages.
</subtitle><entry><title type="html">Hardware-bound Zero Copy Streaming in Apache Cassandra 4.0</title><l