Created
March 28, 2010 07:11
-
-
Save BinaryMuse/346622 to your computer and use it in GitHub Desktop.
DND - Serving GWT app with embedded Java - used on blog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.binarymuse.EmbeddedGwt; | |
import org.eclipse.jetty.server.Server; | |
import org.eclipse.jetty.util.thread.QueuedThreadPool; | |
import org.eclipse.jetty.webapp.WebAppContext; | |
public class EmbeddedGwt { | |
public static void main(String[] args) throws Throwable { | |
// Create an embedded Jetty server on port 8080 | |
Server server = new Server(8080); | |
// Create a handler for processing our GWT app | |
WebAppContext handler = new WebAppContext(); | |
handler.setContextPath("/"); | |
handler.setWar("./apps/GwtApplication.war"); | |
// If your app isn't packaged into a WAR, you can do this instead | |
WebAppContext altHandler = new WebAppContext(); | |
altHandler.setResourceBase("./apps/GwtApplication"); | |
altHandler.setDescriptor("./apps/GwtApplication/WEB-INF/web.xml"); | |
altHandler.setContextPath("/"); | |
altHandler.setParentLoaderPriority(true); | |
// Add it to the server | |
server.setHandler(handler); | |
// Other misc. options | |
server.setThreadPool(new QueuedThreadPool(20)); | |
// And start it up | |
server.start(); | |
server.join(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment