Skip to content

Instantly share code, notes, and snippets.

@bbrowning
Created November 17, 2015 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbrowning/5a10558174ed50f983e1 to your computer and use it in GitHub Desktop.
Save bbrowning/5a10558174ed50f983e1 to your computer and use it in GitHub Desktop.
diff --git a/web-client/src/main/java/org/wildfly/swarm/booker/Main.java b/web-client/src/main/java/org/wildfly/swarm/booker/Main.java
index c3e5448..0b05851 100644
--- a/web-client/src/main/java/org/wildfly/swarm/booker/Main.java
+++ b/web-client/src/main/java/org/wildfly/swarm/booker/Main.java
@@ -1,7 +1,10 @@
package org.wildfly.swarm.booker;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Filters;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.wildfly.swarm.container.Container;
+import org.wildfly.swarm.undertow.DefaultWarDeploymentFactory;
import org.wildfly.swarm.undertow.WARArchive;
/**
@@ -11,9 +14,18 @@ public class Main {
public static void main(String... args) throws Exception {
Container container = new Container();
container.start();
+
WARArchive war = ShrinkWrap.create(WARArchive.class);
- war.staticContent();
war.addAllDependencies();
+
+ // Create an Archive of all resources packaged with this app
+ DefaultWarDeploymentFactory factory = new DefaultWarDeploymentFactory();
+ Archive allResources = factory.create(container);
+ // Add just the static content from that Archive to our war
+ war.merge(allResources, Filters.include(".*\\.(html|js|css|png|json)$"));
+ // Also serve up static content from a few
+ war.staticContent();
+
container.deploy(war);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment