Permalink
Browse files

fix for GRAILS-7018 "Enable use of Tomcat Advanced IO/ NIO connector …

…in Grails Development mode"
  • Loading branch information...
graemerocher committed May 9, 2011
1 parent 8c695a4 commit d94c8be7a20977072f31c96e27cb1b9ab1cbce01
@@ -15,9 +15,10 @@
*/
package org.grails.plugins.tomcat
import grails.util.GrailsNameUtils
import org.apache.catalina.connector.Connector
import org.apache.catalina.startup.Tomcat
import grails.util.*
import org.apache.coyote.http11.Http11NioProtocol
import org.codehaus.groovy.grails.plugins.PluginManagerHolder
/**
@@ -71,6 +72,14 @@ class InlineExplodedTomcatServer extends TomcatServer {
void doStart(String host, int httpPort, int httpsPort) {
preStart()
tomcat.hostname = host
if(getConfigParam("nio")) {
println "Enabling Tomcat NIO connector"
def connector = new Connector(Http11NioProtocol.name)
connector.port = httpPort
tomcat.service.addConnector(connector)
tomcat.connector = connector
}
tomcat.port = httpPort
tomcat.connector.setAttribute("address", host)
tomcat.connector.URIEncoding = 'UTF-8'
@@ -18,6 +18,7 @@
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
import org.apache.coyote.http11.Http11NioProtocol;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -61,6 +62,14 @@ public static void main(String[] args) {
final Tomcat tomcat = new Tomcat();
tomcat.setPort(port);
if(Boolean.getBoolean("tomcat.nio")) {
System.out.println("Enabling Tomcat NIO Connector");
Connector connector = new Connector(Http11NioProtocol.class.getName());
connector.setPort(port);
tomcat.getService().addConnector(connector);
tomcat.setConnector( connector );
}
tomcat.setBaseDir(tomcatDir);
try {
tomcat.addWebapp(contextPath, warPath);
@@ -15,21 +15,7 @@
*/
package org.grails.plugins.tomcat
import org.apache.catalina.Container
import org.apache.catalina.Lifecycle
import org.apache.catalina.LifecycleListener
import org.apache.catalina.Loader
import org.apache.catalina.core.StandardContext
import org.apache.catalina.deploy.ContextEnvironment
import org.apache.catalina.startup.Tomcat
import org.apache.juli.logging.Log
import org.apache.juli.logging.LogFactory
import org.apache.naming.resources.DirContextURLStreamHandlerFactory
import org.apache.naming.resources.DirContextURLStreamHandler
/**
/**
* Serves a packaged war, in a forked JVM.
*/
class IsolatedWarTomcatServer extends TomcatServer {
@@ -81,6 +67,10 @@ class IsolatedWarTomcatServer extends TomcatServer {
for (a in (getConfigParam('jvmArgs') ?: DEFAULT_JVM_ARGS)) {
jvmarg value: a
}
for(entry in getConfigParams()) {
sysproperty key:"tomcat.${entry.key}", value:"${entry.value}"
}
}
}
@@ -125,6 +125,10 @@ abstract class TomcatServer implements EmbeddableServer {
buildSettings.config.grails.tomcat[name]
}
protected Map getConfigParams() {
buildSettings.config.grails.tomcat
}
protected createSSLCertificate() {
println 'Creating SSL Certificate...'

0 comments on commit d94c8be

Please sign in to comment.