Skip to content

Instantly share code, notes, and snippets.

@cdjones32
cdjones32 / change_swagger_host.js
Last active June 7, 2018 22:58 — forked from hareeqi/change_swagger_host.js
dynamic host for swagger ui 3.x
// not the most elgant way but it works
// Modified to poll until the spec has loaded and then update to the current URL.
// Useful for microservices where you deploy the swagger-ui as part of the bundle and
// the Scheme/Hostname/Port are not know at runtime (for example, because they are being hosted by
// Docker, Kubernetes etc...)
function changeSwagger() {
// Try to get the Spec
var newspec = ui.spec().toJSON().resolved;
@cdjones32
cdjones32 / ClusteredSessionReadException.java
Last active September 14, 2015 07:30
Example of how to fix 'java.lang.IllegalStateException: Request has already been read' exceptions when using ClusteredSessionStore. For discussion: https://groups.google.com/forum/#!topic/vertx/928XJiz1wbI
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.handler.CookieHandler;
import io.vertx.ext.web.handler.SessionHandler;
import io.vertx.ext.web.sstore.ClusteredSessionStore;
/*
@cdjones32
cdjones32 / HazelcastClientClusterManager.java
Last active July 5, 2019 19:06
Example VertX Cluster manager to join a cluster as a client instead of a cluster node.
package demo;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.Config;
import com.hazelcast.config.XmlConfigBuilder;
import com.hazelcast.core.*;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;