Skip to content

Instantly share code, notes, and snippets.

@shyiko
Created June 26, 2011 14:05
Show Gist options
  • Save shyiko/1047639 to your computer and use it in GitHub Desktop.
Save shyiko/1047639 to your computer and use it in GitHub Desktop.
Vaadin GWT Jetty Launcher
/*
* Copyright 2011 Stanley Shyiko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.shyiko.gists.vaadin;
import com.google.gwt.core.ext.ServletContainer;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.dev.shell.jetty.JettyLauncher;
import java.io.File;
/**
* Provides ability to use GWT hosted mode embedded Jetty server during Vaadin widgets development. Thus,
* frees from the need to run external server instance.
* <p/>
* The name of this class should be specified as an argument to the com.google.gwt.dev.DevMode -server parameter.
* Also JVM argument -Ddev.mode.app.root should point to web application root directory. That is, if -war parameter
* points to "WebContent/VAADIN/widgetsets" then -Ddev.mode.app.root should be equal to "WebContent".
*
* @author <a href="mailto:[email protected]">shyiko</a>
* @since 25.06.2011
*/
public class DevModeJettyLauncher extends JettyLauncher {
@Override
public ServletContainer start(TreeLogger logger, int port, File appRootDir) throws Exception {
String devModeAppRoot = System.getProperty("dev.mode.app.root");
return super.start(logger, port, devModeAppRoot != null ? new File(devModeAppRoot) : appRootDir);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.shyiko.gists</groupId>
<artifactId>vaadin-gwt-jetty-launcher</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment