Skip to content

8.5.x #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions TomcatGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* limitations under the License.
*/
class TomcatGrailsPlugin {
def version = '8.0.30'
def grailsVersion = '2.3 > *'
def version = '8.5.2'
def grailsVersion = '2.5 > *'
def scopes = [excludes: 'war']
def title = 'Apache Tomcat plugin'
def description = 'Makes Tomcat 8.x the servlet container for Grails at development time'
def description = 'Makes Tomcat 8.5.x the servlet container for Grails at development time'
def documentation = 'http://grails.org/plugin/tomcat'
def license = 'APACHE'
def organization = [name: 'Grails', url: 'http://www.grails.org']
def developers = [
[name: 'Graeme Rocher', email: 'rocherg@ociweb.com'],
[name: 'Burt Beckwith', email: 'burt@burtbeckwith.com']
]
def issueManagement = [system: 'JIRA', url: 'http://jira.grails.org/browse/GPTOMCAT']
def issueManagement = [url: 'https://github.com/grails-plugins/grails-tomcat-plugin/issues']
def scm = [url: 'https://github.com/grails-plugins/grails-tomcat-plugin']
}
2 changes: 1 addition & 1 deletion application.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
app.grails.version=2.5.1
app.grails.version=2.5.3
9 changes: 3 additions & 6 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@ if (System.getenv('TRAVIS_BRANCH')) {
}

grails.project.work.dir = 'target'
grails.project.dependency.resolver = 'maven'

grails.project.dependency.resolver = 'maven'
grails.project.dependency.resolution = {

inherits 'global'
log 'warn'

repositories {
grailsCentral()
mavenLocal()
grailsCentral()
mavenCentral()
}

dependencies {
String tomcatVersion = '8.0.30'

String tomcatVersion = '8.5.2'
compile "org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion"
['el', 'jasper', 'logging-log4j', 'logging-juli', 'websocket'].each {
runtime "org.apache.tomcat.embed:tomcat-embed-$it:$tomcatVersion"
}

provided 'javax.servlet:javax.servlet-api:3.1.0'
}

plugins {
Expand Down
4 changes: 2 additions & 2 deletions grailsw
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fi
if [ -z "$STARTER_CONF" ]; then
STARTER_CONF="$GRAILS_HOME/conf/groovy-starter.conf"
fi
STARTER_CLASSPATH="wrapper/grails-wrapper-runtime-2.5.1.jar:wrapper:."
STARTER_CLASSPATH="wrapper/grails-wrapper-runtime-2.5.3.jar:wrapper:."

# Allow access to Cocoa classes on OS X
if $darwin; then
Expand Down Expand Up @@ -200,7 +200,7 @@ if $mingw ; then
fi

if [ -z "$GRAILS_AGENT_CACHE_DIR" ]; then
GRAILS_AGENT_CACHE_DIR=~/.grails/2.5.1/
GRAILS_AGENT_CACHE_DIR=~/.grails/2.5.3/
fi
SPRINGLOADED_PARAMS=profile=grails\;cacheDir=$GRAILS_AGENT_CACHE_DIR
if [ ! -d "$GRAILS_AGENT_CACHE_DIR" ]; then
Expand Down
6 changes: 3 additions & 3 deletions grailsw.bat
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if "%GRAILS_HOME:~-1%"=="\" SET GRAILS_HOME=%GRAILS_HOME:~0,-1%
:init

for %%x in ("%USERPROFILE%") do set SHORTHOME=%%~fsx
if "x%GRAILS_AGENT_CACHE_DIR%" == "x" set GRAILS_AGENT_CACHE_DIR=%SHORTHOME%/.grails/2.5.1/
if "x%GRAILS_AGENT_CACHE_DIR%" == "x" set GRAILS_AGENT_CACHE_DIR=%SHORTHOME%/.grails/2.5.3/
set SPRINGLOADED_PARAMS="profile=grails;cacheDir=%GRAILS_AGENT_CACHE_DIR%"
if not exist "%GRAILS_AGENT_CACHE_DIR%" mkdir "%GRAILS_AGENT_CACHE_DIR%"

Expand Down Expand Up @@ -140,7 +140,7 @@ set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
set STARTER_CLASSPATH=wrapper/grails-wrapper-runtime-2.5.1.jar;wrapper;.
set STARTER_CLASSPATH=wrapper/grails-wrapper-runtime-2.5.3.jar;wrapper;.

if exist "%USERPROFILE%/.groovy/init.bat" call "%USERPROFILE%/.groovy/init.bat"

Expand Down Expand Up @@ -169,7 +169,7 @@ set JAVA_OPTS=%GRAILS_OPTS% %JAVA_OPTS% %AGENT%

set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name="%PROGNAME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.home="%GRAILS_HOME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.version=2.5.1
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.version=2.5.3
set JAVA_OPTS=%JAVA_OPTS% -Dbase.dir=.
set JAVA_OPTS=%JAVA_OPTS% -Dtools.jar="%TOOLS_JAR%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ import groovy.transform.TypeCheckingMode
import org.apache.catalina.Context
import org.apache.catalina.Loader
import org.apache.catalina.WebResourceRoot
import org.apache.catalina.connector.Connector
import org.apache.catalina.startup.Tomcat
import org.apache.catalina.webresources.StandardRoot
import org.apache.coyote.http11.Http11NioProtocol
import org.apache.tomcat.util.descriptor.web.ContextResource
import org.codehaus.groovy.grails.plugins.GrailsPluginUtils
import org.grails.plugins.tomcat.fork.ForkedTomcatServer

Expand All @@ -38,20 +37,13 @@ import org.grails.plugins.tomcat.fork.ForkedTomcatServer
@CompileStatic
class InlineExplodedTomcatServer extends TomcatServer {

final Tomcat tomcat = new Tomcat()

Context context

InlineExplodedTomcatServer(String basedir, String webXml, String contextPath, ClassLoader classLoader) {

if (contextPath == '/') {
contextPath = ''
}

tomcat.baseDir = tomcatDir.absolutePath
context = tomcat.addWebapp(contextPath, basedir)
configureJarScanner context
tomcat.enableNaming()

// we handle reloading manually
context.reloadable = false
Expand Down Expand Up @@ -106,25 +98,7 @@ class InlineExplodedTomcatServer extends TomcatServer {
void doStart(String host, int httpPort, int httpsPort) {
preStart()

if (host != "localhost") {
tomcat.connector.setAttribute "address", host
tomcat.connector.setAttribute "port", httpPort
}

if (getConfigParam("nio")) {
CONSOLE.updateStatus "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.URIEncoding = 'UTF-8'

if (httpsPort) {
configureSsl host, httpsPort
}
super.doStart host, httpPort, httpsPort

if (Environment.isFork()) {
ForkedTomcatServer.startKillSwitch tomcat, httpPort
Expand All @@ -133,41 +107,12 @@ class InlineExplodedTomcatServer extends TomcatServer {
tomcat.start()
}

@CompileStatic(TypeCheckingMode.SKIP)
protected void configureSsl(String host, int httpsPort) {
def sslConnector = loadInstance('org.apache.catalina.connector.Connector')
sslConnector.scheme = "https"
sslConnector.secure = true
sslConnector.port = httpsPort
sslConnector.setProperty "SSLEnabled", "true"
sslConnector.setAttribute "keystoreFile", keystoreFile.absolutePath
sslConnector.setAttribute "keystorePass", keyPassword
sslConnector.URIEncoding = 'UTF-8'

if (host != "localhost") {
sslConnector.setAttribute "address", host
}

if (truststoreFile.exists()) {
CONSOLE.addStatus "Using truststore $truststore"
sslConnector.setAttribute "truststoreFile", truststore
sslConnector.setAttribute "truststorePass", trustPassword
sslConnector.setAttribute "clientAuth", getConfigParam("clientAuth") ?: "want"
}

tomcat.service.addConnector sslConnector
}

void stop() {
tomcat.stop()
tomcat.destroy()
GrailsPluginUtils.clearCaches()
}

protected loadInstance(String name) {
tomcat.getClass().classLoader.loadClass(name).newInstance()
}

@CompileStatic(TypeCheckingMode.SKIP)
protected void preStart() {
eventListener?.triggerEvent "ConfigureTomcat", tomcat
Expand All @@ -184,16 +129,16 @@ class InlineExplodedTomcatServer extends TomcatServer {
return
}

if (!resCfg["type"]) {
if (!resCfg.type) {
throw new IllegalArgumentException("Must supply a resource type for JNDI configuration")
}

def res = loadInstance('org.apache.catalina.deploy.ContextResource')
res.name = name
res.type = resCfg.remove("type")
res.auth = resCfg.remove("auth")
res.description = resCfg.remove("description")
res.scope = resCfg.remove("scope")
def res = new ContextResource(
auth: resCfg.remove('auth'),
description: resCfg.remove("description"),
name: name,
scope: resCfg.remove('scope'),
type: resCfg.remove('type'))

// now it's only the custom properties left in the Map...
resCfg.each { key, value -> res.setProperty key, value }
Expand Down
2 changes: 1 addition & 1 deletion src/groovy/org/grails/plugins/tomcat/TomcatLoader.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory

/**
* A loader instance used for the embedded version of Tomcat 8.
* A loader instance used for the embedded version of Tomcat.
*
* @author Graeme Rocher
* @since 2.0
Expand Down
Loading